Skip to content

Commit

Permalink
feat: html option fix #110
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 6, 2018
1 parent 99ff244 commit a905189
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/directives/v-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const defaultOptions = {
defaultClass: 'vue-tooltip-theme',
// Default CSS classes applied to the target element of the tooltip
defaultTargetClass: 'has-tooltip',
// Is the content HTML by default?
defaultHtml: true,
// Default HTML template of the tooltip element
// It must include `tooltip-arrow` & `tooltip-inner` CSS classes (can be configured, see below)
// Change if the classes conflict with other libraries (for example bootstrap)
Expand Down Expand Up @@ -83,6 +85,7 @@ export function getOptions (options) {
const result = {
placement: typeof options.placement !== 'undefined' ? options.placement : directive.options.defaultPlacement,
delay: typeof options.delay !== 'undefined' ? options.delay : directive.options.defaultDelay,
html: typeof options.html !== 'undefined' ? options.html : directive.options.defaultHtml,
template: typeof options.template !== 'undefined' ? options.template : directive.options.defaultTemplate,
arrowSelector: typeof options.arrowSelector !== 'undefined' ? options.arrowSelector : directive.options.defaultArrowSelector,
innerSelector: typeof options.innerSelector !== 'undefined' ? options.innerSelector : directive.options.defaultInnerSelector,
Expand Down Expand Up @@ -145,7 +148,6 @@ export function createTooltip (el, value, modifiers = {}) {
let classes = typeof value.classes !== 'undefined' ? value.classes : directive.options.defaultClass
const opts = {
title: content,
html: true,
...getOptions({
...value,
placement: getPlacement(value, modifiers),
Expand Down
1 change: 1 addition & 0 deletions src/directives/v-tooltip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('getOptions', () => {
expect(result).toEqual({
placement: VTooltip.defaultOptions.defaultPlacement,
delay: VTooltip.defaultOptions.defaultDelay,
html: VTooltip.defaultOptions.defaultHtml,
template: VTooltip.defaultOptions.defaultTemplate,
innerSelector: VTooltip.defaultOptions.defaultInnerSelector,
arrowSelector: VTooltip.defaultOptions.defaultArrowSelector,
Expand Down

0 comments on commit a905189

Please sign in to comment.