Skip to content
Permalink
Browse files

fix: tooltip is not updated properly (close #153) (#206)

* fix: tooltip is not updated properly

* refactor: apply code review (#206)
  • Loading branch information...
kyuwoo-choi committed Jun 14, 2018
1 parent e8eaf5d commit 42ad1eccc59f706d3b3afc03a4b5185fd97aa849
@@ -17,7 +17,7 @@ function scrollSyncExtension(editor) {
const i18n = editor.i18n;
const TOOL_TIP = {
active: i18n.get('Auto scroll enabled'),
inActive: i18n.get('Auto scroll disabled')
inactive: i18n.get('Auto scroll disabled')
};

if (editor.isViewer()) {
@@ -64,10 +64,10 @@ function scrollSyncExtension(editor) {
button._onOut();
if (isActive) {
button.$el.addClass('active');
button.tooltip = TOOL_TIP.active;
button.setTooltip(TOOL_TIP.active);
} else {
button.$el.removeClass('active');
button.tooltip = TOOL_TIP.inActive;
button.setTooltip(TOOL_TIP.inactive);
}
button._onOver();
}
@@ -60,6 +60,15 @@ class Button extends ToolbarItem {
}
}

/**
* set tooltip text
* @param {string} text - tooltip text to show
* @memberof button
*/
setTooltip(text) {
this._tooltip = text;
}

_setOptions(options) {
this._command = options.command;
this._event = options.event;
@@ -87,6 +87,11 @@ class Editor {

popup = new Popup();

constructor() {
this.tooltip = Selector('.tui-tooltip');
this.tooltipText = this.tooltip.find('.text');
}

async showWysiwyg() {
await t.click(this.tabbar.wysiwyg);
await this.fixWysiwygCaret();
@@ -0,0 +1,12 @@
import editor from '../editorFixture';

fixture`markdown tooltip`
.page`http://localhost:8080/examples/example13-all-extension-blank.html`;

test('should change enabled/disabled text according to the button tatus #153', async t => {
await t
.hover(editor.toolbar.scrollsync)
.expect(editor.tooltipText.textContent).eql('Auto scroll enabled')
.click(editor.toolbar.scrollsync)
.expect(editor.tooltipText.textContent).eql('Auto scroll disabled');
});

0 comments on commit 42ad1ec

Please sign in to comment.
You can’t perform that action at this time.