Skip to content

Commit

Permalink
Added mocks for theme files
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Oct 20, 2023
1 parent 7cb691f commit ba94735
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 20 deletions.
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-dark-components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-dark-components';
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-dark-palette.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-dark-palette';
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-dark-semantic-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-dark-semantic-editor';
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-dark-semantic-grid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-dark-semantic-grid';
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-dark-semantic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-dark-semantic';
1 change: 1 addition & 0 deletions __mocks__/css/mock-theme-light-palette.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'mock-theme-light-palette';
2 changes: 1 addition & 1 deletion jest.config.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
'node_modules/(?!(monaco-editor|d3-interpolate|d3-color)/)',
],
moduleNameMapper: {
'theme-(.*?)\\.css$': path.join(
'theme-([^/]+?)\\.css(\\?inline)?$': path.join(
__dirname,
'./__mocks__/css/mock-theme-$1.js'
),
Expand Down
11 changes: 8 additions & 3 deletions packages/components/src/theme/ThemeUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,18 @@ describe('getDefaultBaseThemes', () => {
{
name: 'Default Dark',
themeKey: 'default-dark',
styleContent:
'test-file-stub\ntest-file-stub\ntest-file-stub\ntest-file-stub\ntest-file-stub',
styleContent: [
'mock-theme-dark-palette',
'mock-theme-dark-semantic',
'mock-theme-dark-semantic-editor',
'mock-theme-dark-semantic-grid',
'mock-theme-dark-components',
].join('\n'),
},
{
name: 'Default Light',
themeKey: 'default-light',
styleContent: 'test-file-stub',
styleContent: 'mock-theme-light-palette',
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`ThemeProvider setSelectedThemeKey: [ [Object] ] should change selected
<style
data-theme-key="default-light"
>
test-file-stub
mock-theme-light-palette
</style>
<div>
Child
Expand All @@ -34,11 +34,11 @@ exports[`ThemeProvider setSelectedThemeKey: [ [Object] ] should change selected
<style
data-theme-key="default-dark"
>
test-file-stub
test-file-stub
test-file-stub
test-file-stub
test-file-stub
mock-theme-dark-palette
mock-theme-dark-semantic
mock-theme-dark-semantic-editor
mock-theme-dark-semantic-grid
mock-theme-dark-components
</style>
<style
data-theme-key="themeA"
Expand Down Expand Up @@ -75,11 +75,11 @@ exports[`ThemeProvider should load themes based on preload data or default: [ [O
<style
data-theme-key="default-dark"
>
test-file-stub
test-file-stub
test-file-stub
test-file-stub
test-file-stub
mock-theme-dark-palette
mock-theme-dark-semantic
mock-theme-dark-semantic-editor
mock-theme-dark-semantic-grid
mock-theme-dark-components
</style>
<style
data-theme-key="themeA"
Expand All @@ -104,11 +104,11 @@ exports[`ThemeProvider should load themes based on preload data or default: [ [O
<style
data-theme-key="default-dark"
>
test-file-stub
test-file-stub
test-file-stub
test-file-stub
test-file-stub
mock-theme-dark-palette
mock-theme-dark-semantic
mock-theme-dark-semantic-editor
mock-theme-dark-semantic-grid
mock-theme-dark-components
</style>
<div>
Child
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[class^='spectrum'] {
/* --font-family-sans-serif is defined in Bootstrap's _root.scss. We want
Spectrum to use the same default font-family */
font-family: var(--font-family-sans-serif) !important;
}

0 comments on commit ba94735

Please sign in to comment.