Skip to content

Commit

Permalink
Update tests to expect new medium-editor-element class
Browse files Browse the repository at this point in the history
  • Loading branch information
nmielnik committed Jun 6, 2016
1 parent b1585f2 commit e2a79ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions spec/elements.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ describe('Elements TestCase', function () {
expect(this.el.getAttribute('contenteditable')).toBeFalsy();
});

it('should set element data attr medium-editor-element to true', function () {
it('should set element data attr medium-editor-element to true and add medium-editor-element class', function () {
var editor = this.newMediumEditor('.editor');
expect(editor.elements.length).toBe(1);
expect(this.el.getAttribute('data-medium-editor-element')).toEqual('true');
expect(this.el.className).toBe('editor medium-editor-element');
});

it('should set element role attribute to textbox', function () {
Expand Down Expand Up @@ -65,11 +66,15 @@ describe('Elements TestCase', function () {
expect(this.el.hasAttribute('contenteditable')).toBe(false);
});

it('should remove the medium-editor-element attribute', function () {
it('should remove the medium-editor-element attribute and class name', function () {
this.el.classList.add('temp-class');
expect(this.el.className).toBe('editor temp-class');
var editor = this.newMediumEditor('.editor');
expect(this.el.getAttribute('data-medium-editor-element')).toEqual('true');
expect(this.el.className).toBe('editor temp-class medium-editor-element');
editor.destroy();
expect(this.el.hasAttribute('data-medium-editor-element')).toBe(false);
expect(this.el.className).toBe('editor temp-class');
});

it('should remove the role attribute', function () {
Expand Down
4 changes: 2 additions & 2 deletions spec/textarea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Textarea TestCase', function () {
it('should preserve textarea className', function () {
this.el.className += ' test-class test-class-2';
var editor = this.newMediumEditor('.editor');
expect(editor.elements[0].className).toBe('editor test-class test-class-2');
expect(editor.elements[0].className).toBe('editor test-class test-class-2 medium-editor-element');
});

it('should create unique div ids for multiple textareas', function () {
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('Textarea TestCase', function () {
this.el.className += ' test-class test-class-2';
var editor = this.newMediumEditor('.editable-div');
editor.addElements(this.el);
expect(editor.elements[1].className).toBe('editor test-class test-class-2');
expect(editor.elements[1].className).toBe('editor test-class test-class-2 medium-editor-element');
});

it('should create unique div ids for multiple textareas', function () {
Expand Down

0 comments on commit e2a79ae

Please sign in to comment.