Skip to content

Commit 10e200e

Browse files
committed
Merge branch 'darkmode' into 'main'
Add support for dark mode dimension See merge request fun-tech/shutterbug!77
2 parents a434593 + 97ca2eb commit 10e200e

5 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/model/Dimensions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const DEVICE = 'device';
33
export const ORIENTATION = 'orientation';
44
export const PLATFORM = 'platform';
55
export const RESOLUTION = 'resolution';
6+
export const DARKMODE = 'darkmode';
67

78
// TODO maybe add union type consisting of the string constants and use that tye in DimensionMap
89
export type DimensionMap = Map<string,string[]>

src/model/TestCase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export class TestCase {
1212
readonly isValid: boolean;
1313
readonly screenshotFilename: string;
1414

15-
constructor( readonly dimensions: Map<string,string>, readonly bannerUrl: string, readonly invalidReason: string = '' ) {
16-
this.screenshotFilename = [ ...dimensions.values() ].join( '__' ) + '.png';
15+
constructor( readonly dimensions: Map<string,string>, readonly screenshotFilename: string, readonly bannerUrl: string, readonly invalidReason: string = '' ) {
16+
this.screenshotFilename = screenshotFilename;
1717
this.isValid = invalidReason === '';
1818
}
1919

@@ -32,7 +32,7 @@ export class TestCase {
3232

3333
static fromObject( obj: RawTestCase ): TestCase {
3434
const dimensions = new Map<string, string>(obj.dimensions);
35-
return new TestCase( dimensions, obj.bannerUrl, getInvalidReasonFromState( obj.state ) );
35+
return new TestCase( dimensions, obj.screenshotFilename, obj.bannerUrl, getInvalidReasonFromState( obj.state ) );
3636
}
3737

3838
}

src/model/parseMetadata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const DimensionRunType = Union(
66
Literal('orientation'),
77
Literal('platform'),
88
Literal('resolution'),
9+
Literal('darkmode'),
910
);
1011

1112
const DimensionValueRunType = Tuple(DimensionRunType, String);
@@ -17,6 +18,7 @@ const TestCaseStateRunType = Record( {
1718

1819
const TestCaseRunType = Record( {
1920
dimensions: Array(DimensionValueRunType),
21+
screenshotFilename: String,
2022
bannerUrl: String,
2123
state: TestCaseStateRunType,
2224
} );

src/views/Slides.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import Slideshow from "@/components/Slideshow.vue";
4545
4646
import {ScreenshotMetaData} from "@/model/ScreenshotMetaData";
47-
import {BANNER, DEVICE, PLATFORM, ORIENTATION, RESOLUTION} from "@/model/Dimensions";
47+
import {BANNER, DEVICE, PLATFORM, ORIENTATION, RESOLUTION, DARKMODE} from "@/model/Dimensions";
4848
import {createGrid} from "@/model/createGrid";
4949
import SlideshowPosition from "@/model/slideshowPosition";
5050
import {createDimensionCombinations} from "@/model/createDimensionCombinations";
@@ -72,7 +72,7 @@
7272
7373
// TODO Talk to others to come up with the best order
7474
// TODO switch BROWSER and BANNER when we have A/B test cases in the example/live data
75-
const preferredOrderOfDimensions = [ BANNER, DEVICE, RESOLUTION, PLATFORM, ORIENTATION ];
75+
const preferredOrderOfDimensions = [ BANNER, DEVICE, RESOLUTION, PLATFORM, ORIENTATION, DARKMODE ];
7676
const metaDataInit: MetadataState = {
7777
isLoading: true,
7878
metaData: null,

tests/unit/TestCase.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('TestCase', () => {
2525
]
2626
],
2727
"bannerUrl": "https://de.wikipedia.org/wiki/Wikipedia:Hauptseite?banner=B20_WMDE_Test_Desktop",
28+
"screenshotFilename": 'edge__1024x768__ctrl.png',
2829
} );
2930

3031
expect( testCase.screenshotFilename ).toBe( 'edge__1024x768__ctrl.png' );

0 commit comments

Comments
 (0)