Skip to content

Commit

Permalink
[CLEANUP] Remove deprecated toggleSectionTagName
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Apr 7, 2016
1 parent 270cc33 commit 3ac0ede
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 39 deletions.
8 changes: 0 additions & 8 deletions addon/components/mobiledoc-editor/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ export default Component.extend({
editor.run(postEditor => postEditor.toggleSection(newTagName));
},

// Deprecated
toggleSectionTagName(newTagName) {
Ember.warn('toggleSectionTagName is deprecated. Use toggleSection instead',
false,
{id: 'mobiledoc-editor-toggleSectionTagName'});
this.send('toggleSection', newTagName);
},

createListSection(tagName) {
const editor = this.get('editor');
const section = editor.activeSections[0];
Expand Down
1 change: 0 additions & 1 deletion addon/components/mobiledoc-editor/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
addCard=(action 'addCard')
addCardInEditMode=(action 'addCardInEditMode')
toggleSection=(action 'toggleSection')
toggleSectionTagName=(action 'toggleSectionTagName')
createListSection=(action 'createListSection')
)}}

Expand Down
30 changes: 0 additions & 30 deletions tests/integration/components/mobiledoc-editor/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,36 +318,6 @@ test('it exposes "toggleSection" which toggles the section type and fires `on-ch
assert.ok(!this.$('h2').length, 'toggles h2 tag off again');
});

test('it exposes "toggleSectionTagName" (deprecated) which toggles the section type and fires `on-change`', function(assert) {
assert.expect(6);

let onChangeCount = 0;

let text = 'Howdy';
this.set('mobiledoc', simpleMobileDoc(text));
this.on('on-change', () => onChangeCount++);
this.render(hbs`
{{#mobiledoc-editor mobiledoc=mobiledoc on-change=(action 'on-change') as |editor|}}
<button {{action editor.toggleSectionTagName 'h2'}}>H2</button>
{{/mobiledoc-editor}}
`);
const textNode = this.$(`p:contains(${text})`)[0].firstChild;
selectRange(textNode, 0, textNode, text.length);

assert.ok(!this.$('h2').length, 'precond - no h2');
assert.equal(onChangeCount, 0, 'precond - no on-change');

this.$('button').click();

assert.equal(onChangeCount, 1, 'fires on-change');
assert.ok(!!this.$('h2:contains(Howdy)').length, 'Changes to h2 tag');

onChangeCount = 0;
this.$('button').click();
assert.equal(onChangeCount, 1, 'fires on-change again');
assert.ok(!this.$('h2').length, 'toggles h2 tag off again');
});

test('toolbar buttons can be active', function(assert) {
let text = 'abc';
this.set('mobiledoc', simpleMobileDoc(text));
Expand Down

0 comments on commit 3ac0ede

Please sign in to comment.