Adds props to allow tooltip config. Breaks tests into specific cases

This commit is contained in:
Filipa Lacerda 2018-01-11 11:17:02 +00:00
parent e331ca13e5
commit 0d99f6c620
No known key found for this signature in database
GPG Key ID: 9CA3FDE4D1E2F1C8
2 changed files with 19 additions and 1 deletions

View File

@ -18,6 +18,16 @@
type: String,
required: true,
},
tooltipPlacement: {
type: String,
required: false,
default: 'top',
},
tooltipContainer: {
type: [String, Boolean],
required: false,
default: false,
},
},
};
</script>
@ -29,6 +39,8 @@
:title="title"
:data-clipboard-text="text"
v-tooltip
:data-container="tooltipContainer"
:data-placement="tooltipPlacement"
>
<i
aria-hidden="true"

View File

@ -17,9 +17,15 @@ describe('clipboard button', () => {
vm.$destroy();
});
it('renders a button for clipboard with a tooltip', () => {
it('renders a button for clipboard', () => {
expect(vm.$el.tagName).toEqual('BUTTON');
expect(vm.$el.getAttribute('data-clipboard-text')).toEqual('copy me');
expect(vm.$el.querySelector('i').className).toEqual('fa fa-clipboard');
});
it('should have a tooltip with default values', () => {
expect(vm.$el.getAttribute('data-original-title')).toEqual('Copy this value into Clipboard!');
expect(vm.$el.getAttribute('data-placement')).toEqual('top');
expect(vm.$el.getAttribute('data-container')).toEqual(null);
});
});