Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the editor triggers an update when clicking "heading" #59

Merged
merged 1 commit into from
Aug 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/js/commands/format-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class FormatBlockCommand extends TextFormatCommand {

editor.rerender();
editor.selectSections(activeSections);
this.editor.didUpdate();
}

unexec() {
Expand All @@ -41,6 +42,7 @@ class FormatBlockCommand extends TextFormatCommand {

editor.rerender();
editor.selectSections(activeSections);
this.editor.didUpdate();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/commands/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export default class ImageCommand extends Command {
sections.forEach(section => section.renderNode.scheduleForRemoval());

this.editor.rerender();
this.editor.trigger('update');
this.editor.didUpdate();
}
}
18 changes: 18 additions & 0 deletions tests/acceptance/editor-commands-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ test('highlight text, click "heading" button turns text into h2 header', (assert
});
});

test('click heading button triggers update', (assert) => {
const done = assert.async();
const triggered = [];
const triggerFn = editor.trigger;
editor.trigger = (name, ...args) => {
triggered.push(name);
triggerFn.call(editor, name, ...args);
};

setTimeout(() => {
Helpers.toolbar.clickButton(assert, 'heading');
assert.ok(triggered.indexOf('update') !== -1,
'update was triggered');

done();
});
});

test('highlighting heading text activates toolbar button', (assert) => {
const done = assert.async();

Expand Down