Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
1a9822eb
Commit
1a9822eb
authored
Jun 04, 2017
by
kingwl
Committed by
杨奕
Jun 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ColorPicker: fix invalid hue bar click when saturation is zero (#5080)
parent
7e7a731e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
packages/color-picker/src/components/hue-slider.vue
packages/color-picker/src/components/hue-slider.vue
+1
-1
packages/color-picker/src/components/sv-panel.vue
packages/color-picker/src/components/sv-panel.vue
+9
-0
test/unit/specs/color-picker.spec.js
test/unit/specs/color-picker.spec.js
+27
-0
No files found.
packages/color-picker/src/components/hue-slider.vue
View file @
1a9822eb
...
...
@@ -33,7 +33,7 @@
},
watch
:
{
'
color.
val
ue
'
()
{
'
color.
_h
ue
'
()
{
this
.
update
();
}
},
...
...
packages/color-picker/src/components/sv-panel.vue
View file @
1a9822eb
...
...
@@ -30,6 +30,15 @@
watch
:
{
'
color.value
'
()
{
this
.
update
();
},
/*
* FIXME: trigger update twice
* when saturation is zero, modify hue will not change value.
* panel also not to be updated. so i subscribe the hue change to update panel too.
* but if hue changed, update will be call twice.
*/
'
color._hue
'
()
{
this
.
update
();
}
},
...
...
test/unit/specs/color-picker.spec.js
View file @
1a9822eb
...
...
@@ -184,6 +184,33 @@ describe('ColorPicker', () => {
},
ANIMATION_TIME
);
});
it
(
'
should change hue when saturation is zero
'
,
(
done
)
=>
{
const
vm
=
createVue
({
template
:
`
<el-color-picker v-model="color"></el-color-picker>
`
,
data
()
{
return
{
color
:
'
#FFFFFF
'
};
}
},
true
);
const
trigger
=
vm
.
$el
.
querySelector
(
'
.el-color-picker__trigger
'
);
trigger
.
click
();
setTimeout
(()
=>
{
const
hueBar
=
document
.
querySelector
(
'
.el-color-hue-slider
'
);
hueBar
.
__vue__
.
handleClick
({
target
:
null
,
clientX
:
0
,
clientY
:
1000
});
vm
.
$nextTick
(()
=>
{
const
thumb
=
document
.
querySelector
(
'
.el-color-hue-slider__thumb
'
);
expect
(
parseInt
(
thumb
.
style
.
top
,
10
)
>
0
).
to
.
true
;
done
();
});
},
ANIMATION_TIME
);
});
it
(
'
should change alpha when clicking the alpha bar
'
,
(
done
)
=>
{
const
vm
=
createVue
({
template
:
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment