diff options
author | Phil Hughes <me@iamphill.com> | 2019-04-04 11:21:28 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-04-04 11:21:28 +0300 |
commit | 064dd7aa2f4229068c0d1fcaaecc16d51952a5bd (patch) | |
tree | 6e70b10982edd02bc9dd4358568830e9c8115bdc | |
parent | e81b4f90553e5141b2a6f16f5c71815ad510e7c7 (diff) | |
parent | 52515dda0b2fc3818eae243a324f5dfb88414c37 (diff) |
Merge branch 'winh-sidebar-todo' into 'master'
Copy sidebar todo component from EE
Closes gitlab-ee#9954
See merge request gitlab-org/gitlab-ce!26915
-rw-r--r-- | app/assets/javascripts/sidebar/components/todo_toggle/todo.vue | 5 | ||||
-rw-r--r-- | spec/javascripts/sidebar/todo_spec.js | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/sidebar/components/todo_toggle/todo.vue b/app/assets/javascripts/sidebar/components/todo_toggle/todo.vue index 706e6ca19c3..57125c78cf6 100644 --- a/app/assets/javascripts/sidebar/components/todo_toggle/todo.vue +++ b/app/assets/javascripts/sidebar/components/todo_toggle/todo.vue @@ -50,6 +50,9 @@ export default { buttonLabel() { return this.isTodo ? MARK_TEXT : TODO_TEXT; }, + buttonTooltip() { + return !this.collapsed ? undefined : this.buttonLabel; + }, collapsedButtonIconClasses() { return this.isTodo ? 'todo-undone' : ''; }, @@ -69,7 +72,7 @@ export default { <button v-tooltip :class="buttonClasses" - :title="buttonLabel" + :title="buttonTooltip" :aria-label="buttonLabel" :data-issuable-id="issuableId" :data-issuable-type="issuableType" diff --git a/spec/javascripts/sidebar/todo_spec.js b/spec/javascripts/sidebar/todo_spec.js index 657e88ecb96..f46ea5a0499 100644 --- a/spec/javascripts/sidebar/todo_spec.js +++ b/spec/javascripts/sidebar/todo_spec.js @@ -116,7 +116,7 @@ describe('SidebarTodo', () => { const dataAttributes = { issuableId: '1', issuableType: 'epic', - originalTitle: 'Mark todo as done', + originalTitle: '', placement: 'left', container: 'body', boundary: 'viewport', @@ -130,6 +130,10 @@ describe('SidebarTodo', () => { }); }); + it('check button label computed property', () => { + expect(vm.buttonLabel).toEqual('Mark todo as done'); + }); + it('renders button label element when `collapsed` prop is `false`', () => { const buttonLabelEl = vm.$el.querySelector('span.issuable-todo-inner'); |