-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-color-palette): set selected color to inner color picker (#1…
…0276) Until now, when a color is being selected in ui5-color-palette or ui5-color-palette-popover, and the inner ui5-color-picker is being opened via More Colors... button, the selected color was not shown in the picker nor in the color area or color sliders, nor as RGBA values. This PR adds this feature and now when there is selected color in the color palette/color palette popover, and the color picker is activated, it displays the selected color and its RGBA values. Fixes #8772
- Loading branch information
1 parent
e655644
commit 7a152a1
Showing
6 changed files
with
134 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { html } from "lit"; | ||
import "../../src/ColorPalette.js"; | ||
import "../../src/ColorPaletteItem.js"; | ||
import "../../src/features/ColorPaletteMoreColors.js"; | ||
|
||
describe("Color Palette tests", () => { | ||
it("internal color picker should have selected color set on open", () => { | ||
cy.mount(html`<ui5-color-palette show-more-colors show-recent-colors> | ||
<ui5-color-palette-item id="named" value="red"></ui5-color-palette-item> | ||
<ui5-color-palette-item id="rgba" value="rgba(0, 255, 0, 0.5)"></ui5-color-palette-item> | ||
<ui5-color-palette-item id="rgb" value="rgb(0,0,255)"></ui5-color-palette-item> | ||
<ui5-color-palette-item id="hex" value="#C0FFEE"></ui5-color-palette-item> | ||
</ui5-color-palette>`); | ||
|
||
cy.get("ui5-color-palette") | ||
.ui5ColorPaletteCheckSelectedColor("#named", { | ||
r: "255", | ||
g: "0", | ||
b: "0", | ||
a: "1", | ||
}); | ||
|
||
cy.get("ui5-color-palette") | ||
.ui5ColorPaletteCheckSelectedColor("#rgba", { | ||
r: "0", | ||
g: "255", | ||
b: "0", | ||
a: "0.5", | ||
}); | ||
|
||
cy.get("ui5-color-palette") | ||
.ui5ColorPaletteCheckSelectedColor("#rgb", { | ||
r: "0", | ||
g: "0", | ||
b: "255", | ||
a: "1", | ||
}); | ||
|
||
cy.get("ui5-color-palette") | ||
.ui5ColorPaletteCheckSelectedColor("#hex", { | ||
r: "192", | ||
g: "255", | ||
b: "238", | ||
a: "1", | ||
}); | ||
}); | ||
}); |
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
62 changes: 62 additions & 0 deletions
62
packages/main/cypress/support/commands/ColorPalette.commands.ts
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Cypress.Commands.add("ui5ColorPaletteCheckSelectedColor", { prevSubject: true }, (subject, colorPaletteItem, values) => { | ||
cy.get(subject) | ||
.as("colorPalette"); | ||
|
||
cy.get("ui5-color-palette") | ||
.shadow() | ||
.find(".ui5-cp-more-colors") | ||
.as("moreColors"); | ||
|
||
cy.get("@colorPalette") | ||
.find(colorPaletteItem) | ||
.realClick(); | ||
|
||
cy.get("@moreColors") | ||
.realClick(); | ||
|
||
cy.get("@colorPalette") | ||
.shadow() | ||
.find("ui5-color-picker") | ||
.as("colorPicker"); | ||
|
||
cy.get("@colorPicker") | ||
.shadow() | ||
.find("#red") | ||
.as("redColor"); | ||
|
||
cy.get("@colorPicker") | ||
.shadow() | ||
.find("#green") | ||
.as("greenColor"); | ||
|
||
cy.get("@colorPicker") | ||
.shadow() | ||
.find("#blue") | ||
.as("blueColor"); | ||
|
||
cy.get("@colorPicker") | ||
.shadow() | ||
.find("#alpha") | ||
.as("alpha"); | ||
|
||
cy.get("@colorPalette") | ||
.shadow() | ||
.find("ui5-dialog") | ||
.find("ui5-button") | ||
.as("okButton"); | ||
|
||
cy.get("@redColor") | ||
.should("have.attr", "value", values.r); | ||
|
||
cy.get("@greenColor") | ||
.should("have.attr", "value", values.g); | ||
|
||
cy.get("@blueColor") | ||
.should("have.attr", "value", values.b); | ||
|
||
cy.get("@alpha") | ||
.should("have.attr", "value", values.a); | ||
|
||
cy.get("@okButton") | ||
.realClick(); | ||
}); |
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