Skip to content

Commit

Permalink
FIx test
Browse files Browse the repository at this point in the history
  • Loading branch information
haven2world committed Jun 3, 2024
1 parent 5d7249e commit 013feb5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down Expand Up @@ -180,6 +181,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
mockedGetDarkColor,
undefined,
undefined
);
});
Expand Down Expand Up @@ -213,6 +215,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down Expand Up @@ -246,6 +249,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down Expand Up @@ -279,6 +283,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down Expand Up @@ -312,6 +317,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down Expand Up @@ -345,6 +351,7 @@ describe('createEditorCore', () => {
expect(DarkColorHandlerImpl.createDarkColorHandler).toHaveBeenCalledWith(
mockedDiv,
getDarkColorFallback,
undefined,
undefined
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const VARIABLE_REGEX = /^\s*var\(\s*(\-\-[a-zA-Z0-9\-_]+)\s*(?:,\s*(.*))?\)\s*$/
const VARIABLE_PREFIX = 'var(';
const VARIABLE_POSTFIX = ')';
const COLOR_VAR_PREFIX = '--darkColor';
const COLOR_VAR_ENFORCE_FALLBACK_KEY = 'fallback-color';
const COLOR_VAR_ENFORCE_FALLBACK_KEY = `${COLOR_VAR_PREFIX}_fallback-color`;

/**
* Get color from given HTML element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ describe('setColor with darkColorHandler', () => {

it('no existing color, set valid color, skip known colors, getDarkColor return null', () => {
knownColors = {
white: {
'--darkColor_white': {
lightModeColor: 'white',
darkModeColor: 'black',
},
Expand All @@ -518,10 +518,10 @@ describe('setColor with darkColorHandler', () => {
setColor(darkDiv, 'white', false, true, darkColorHandler);

expect(lightDiv.outerHTML).toBe(
'<div style="color: white; background-color: white;"></div>'
'<div style="background-color: white; color: white;"></div>'
);
expect(darkDiv.outerHTML).toBe(
'<div style="color: var(--darkColor_fallback-color, white); background-color: var(--darkColor_fallback-color, white);"></div>'
'<div style="background-color: var(--darkColor_fallback-color, white); color: var(--darkColor_fallback-color, white);"></div>'
);
expect(getDarkColorSpy).toHaveBeenCalledTimes(4);
expect(updateKnownColorSpy).toHaveBeenCalledTimes(0);
Expand Down

0 comments on commit 013feb5

Please sign in to comment.