-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(color-picker): change modes not working (#78)
* fix(color-picker): change modes not working * docs(changelog): add issue url
- Loading branch information
Showing
10 changed files
with
81 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Compared with real world, its space is discrete. | |
basic | ||
alpha | ||
size | ||
modes | ||
form | ||
``` | ||
|
||
|
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,7 @@ | ||
# Set Mode | ||
|
||
Use `modes` to set available modes. | ||
|
||
```html | ||
<n-color-picker :modes="['hex']" /> | ||
``` |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
basic | ||
alpha | ||
size | ||
modes | ||
form | ||
``` | ||
|
||
|
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,7 @@ | ||
# 设定模式 | ||
|
||
使用 `modes` 设定可选模式。 | ||
|
||
```html | ||
<n-color-picker :modes="['hex']" /> | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { nextTick } from 'vue' | ||
import { mount } from '@vue/test-utils' | ||
import { NColorPicker } from '../index' | ||
|
||
describe('n-color-picker', () => { | ||
it('should work with import on demand', () => { | ||
mount(NColorPicker) | ||
}) | ||
describe('props.modes', () => { | ||
it('multiple modes', async () => { | ||
const wrapper = mount(NColorPicker, { | ||
attachTo: document.body, | ||
props: { | ||
modes: ['hex', 'hsl'] | ||
} | ||
}) | ||
await wrapper.find('.n-color-picker-trigger').trigger('click') | ||
expect(document.querySelector('.n-color-picker-panel')).not.toEqual(null) | ||
const modeDom = document.querySelector('.n-color-picker-input__mode') | ||
expect(modeDom?.textContent).toEqual('HEXA') | ||
;(modeDom as HTMLElement).click() | ||
await nextTick() | ||
expect(modeDom?.textContent).toEqual('HSLA') | ||
;(modeDom as HTMLElement).click() | ||
await nextTick() | ||
expect(modeDom?.textContent).toEqual('HEXA') | ||
wrapper.unmount() | ||
}) | ||
it('single mode', async () => { | ||
const wrapper = mount(NColorPicker, { | ||
attachTo: document.body, | ||
props: { | ||
modes: ['hex'] | ||
} | ||
}) | ||
await wrapper.find('.n-color-picker-trigger').trigger('click') | ||
expect(document.querySelector('.n-color-picker-panel')).not.toEqual(null) | ||
const modeDom = document.querySelector('.n-color-picker-input__mode') | ||
expect(modeDom?.textContent).toEqual('HEXA') | ||
;(modeDom as HTMLElement).click() | ||
await nextTick() | ||
expect(modeDom?.textContent).toEqual('HEXA') | ||
wrapper.unmount() | ||
}) | ||
}) | ||
}) |
5b75311
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: