Skip to content

Commit

Permalink
Use proxy method execAction instead createLink
Browse files Browse the repository at this point in the history
I think it's better if extension always use the proxy method
`execAction` instead of calling directly core option.
  • Loading branch information
j0k3r committed May 23, 2015
1 parent 7cbebeb commit 84ebe09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/anchor.spec.js
Expand Up @@ -54,8 +54,7 @@ describe('Anchor Button TestCase', function () {
it('should create a link when user presses enter', function () {
spyOn(MediumEditor.prototype, 'createLink').and.callThrough();
var editor = this.newMediumEditor('.editor'),
button,
input;
button, input;

selectElementContents(editor.elements[0]);
button = editor.toolbar.getToolbarElement().querySelector('[data-action="createLink"]');
Expand All @@ -66,6 +65,7 @@ describe('Anchor Button TestCase', function () {
keyCode: Util.keyCode.ENTER
});
expect(editor.createLink).toHaveBeenCalled();
expect(this.el.innerHTML).toBe('<a href="test">lorem ipsum</a>');
});

it('shouldn\'t create a link when user presses enter without value', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/anchor.js
Expand Up @@ -205,7 +205,7 @@ var AnchorForm;

completeFormSave: function (opts) {
this.base.restoreSelection();
this.base.createLink(opts);
this.base.execAction(this.action, opts);
this.base.checkSelection();
},

Expand Down

0 comments on commit 84ebe09

Please sign in to comment.