-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Add support for changing sticky notes color in new canv…
…as (no-changelog) (#10593)
- Loading branch information
1 parent
821ca16
commit c988931
Showing
11 changed files
with
340 additions
and
17 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
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
43 changes: 43 additions & 0 deletions
43
...tor-ui/src/components/canvas/elements/nodes/toolbar/CanvasNodeStickyColorSelector.spec.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,43 @@ | ||
import { fireEvent } from '@testing-library/vue'; | ||
import CanvasNodeStickyColorSelector from '@/components/canvas/elements/nodes/toolbar/CanvasNodeStickyColorSelector.vue'; | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import { createCanvasNodeProvide } from '@/__tests__/data'; | ||
|
||
const renderComponent = createComponentRenderer(CanvasNodeStickyColorSelector); | ||
|
||
describe('CanvasNodeStickyColorSelector', () => { | ||
it('should render trigger correctly', () => { | ||
const { getByTestId } = renderComponent({ | ||
global: { | ||
provide: { | ||
...createCanvasNodeProvide(), | ||
}, | ||
}, | ||
}); | ||
const colorSelector = getByTestId('change-sticky-color'); | ||
expect(colorSelector).toBeVisible(); | ||
}); | ||
|
||
it('should render all colors and apply selected color correctly', async () => { | ||
const { getByTestId, getAllByTestId, emitted } = renderComponent({ | ||
global: { | ||
provide: { | ||
...createCanvasNodeProvide(), | ||
}, | ||
}, | ||
}); | ||
|
||
const colorSelector = getByTestId('change-sticky-color'); | ||
|
||
await fireEvent.click(colorSelector); | ||
|
||
const colorOption = getAllByTestId('color'); | ||
const selectedIndex = 2; | ||
|
||
await fireEvent.click(colorOption[selectedIndex]); | ||
|
||
expect(colorOption).toHaveLength(7); | ||
expect(emitted()).toHaveProperty('update'); | ||
expect(emitted().update[0]).toEqual([selectedIndex + 1]); | ||
}); | ||
}); |
Oops, something went wrong.