-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit makes sure it is possible to overwrite the globally defin…
…ed colors settings (colors arrays and disableCustomColors) in PanelColorSettings. The overwrite can be global for all the color panels of the component or local per each settings panel.
- Loading branch information
1 parent
8d80814
commit 42b4476
Showing
6 changed files
with
291 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 69 additions & 30 deletions
99
packages/editor/src/components/panel-color-settings/test/__snapshots__/index.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,74 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PanelColorSettings matches the snapshot 1`] = ` | ||
<PanelBody | ||
className="editor-panel-color-settings" | ||
title={ | ||
<span | ||
className="editor-panel-color-settings__panel-title" | ||
> | ||
Test Title | ||
<ColorIndicator | ||
aria-label="(border color: #000)" | ||
colorValue="#000" | ||
/> | ||
<ColorIndicator | ||
aria-label="(background color: #111)" | ||
colorValue="#111" | ||
/> | ||
</span> | ||
<Component | ||
colorSettings={ | ||
Array [ | ||
Object { | ||
"label": "border color", | ||
"onChange": [Function], | ||
"value": "#000", | ||
}, | ||
Object { | ||
"label": "background color", | ||
"onChange": [Function], | ||
"value": "#111", | ||
}, | ||
] | ||
} | ||
> | ||
<WithColorContext(ColorPaletteControl) | ||
key="0" | ||
label="border color" | ||
onChange={[Function]} | ||
value="#000" | ||
/> | ||
<WithColorContext(ColorPaletteControl) | ||
key="1" | ||
label="background color" | ||
onChange={[Function]} | ||
value="#111" | ||
/> | ||
</PanelBody> | ||
colors={Array []} | ||
title="Test Title" | ||
/> | ||
`; | ||
|
||
exports[`PanelColorSettings should render a color panel if at least one setting specifies some colors to choose 1`] = ` | ||
<Component | ||
colorSettings={ | ||
Array [ | ||
Object { | ||
"colors": Array [ | ||
Object { | ||
"color": "#ff0000", | ||
"name": "Red", | ||
"slug": "red", | ||
}, | ||
], | ||
"label": "border color", | ||
"onChange": [Function], | ||
"value": "#000", | ||
}, | ||
Object { | ||
"label": "background color", | ||
"onChange": [Function], | ||
"value": "#111", | ||
}, | ||
] | ||
} | ||
colors={Array []} | ||
disableCustomColors={true} | ||
title="Test Title" | ||
/> | ||
`; | ||
|
||
exports[`PanelColorSettings should render a color panel if at least one setting supports custom colors 1`] = ` | ||
<Component | ||
colorSettings={ | ||
Array [ | ||
Object { | ||
"label": "border color", | ||
"onChange": [Function], | ||
"value": "#000", | ||
}, | ||
Object { | ||
"disableCustomColors": false, | ||
"label": "background color", | ||
"onChange": [Function], | ||
"value": "#111", | ||
}, | ||
] | ||
} | ||
colors={Array []} | ||
disableCustomColors={true} | ||
title="Test Title" | ||
/> | ||
`; |
Oops, something went wrong.