diff --git a/Gruntfile.js b/Gruntfile.js index 2ce895c78..8544542de 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -290,7 +290,7 @@ module.exports = function (grunt) { gruntConfig['saucelabs-jasmine'] = { all: { options: { - urls: ['http://127.0.0.1:9999/_SpecRunner.html'], + urls: ['http://localhost:9999/_SpecRunner.html'], tunnelTimeout: 5, build: process.env.TRAVIS_JOB_ID, concurrency: 3, diff --git a/spec/buttons.spec.js b/spec/buttons.spec.js index 5132f35e7..25aa208e5 100644 --- a/spec/buttons.spec.js +++ b/spec/buttons.spec.js @@ -431,6 +431,9 @@ describe('Buttons TestCase', function () { expect(button.classList.contains('medium-editor-button-active')).toBe(true); fireEvent(button, 'click'); + + this.el.innerHTML = stripAttrIfEmpty(this.el, 'style'); + // style="font-weight: bold" prevents IE9+10 from doing anything when 'bold' is triggered // but it should work in other browsers expect(!isOldIE() && button.classList.contains('medium-editor-button-active')).toBe(false); @@ -507,6 +510,9 @@ describe('Buttons TestCase', function () { expect(button.classList.contains('medium-editor-button-active')).toBe(true); fireEvent(button, 'click'); + + this.el.innerHTML = stripAttrIfEmpty(this.el, 'style'); + // style="font-style: italic" prevents IE9+10 from doing anything when 'italic' is triggered // but it should work in other browsers expect(!isOldIE() && button.classList.contains('medium-editor-button-active')).toBe(false); @@ -566,6 +572,9 @@ describe('Buttons TestCase', function () { expect(button.classList.contains('medium-editor-button-active')).toBe(true); fireEvent(button, 'click'); + + this.el.innerHTML = stripAttrIfEmpty(this.el, 'style'); + // style="text-decoration: underline" prevents IE9+10 from doing anything when 'underline' is triggered // but it should work in other browsers expect(!isOldIE() && button.classList.contains('medium-editor-button-active')).toBe(false); @@ -625,6 +634,9 @@ describe('Buttons TestCase', function () { expect(button.classList.contains('medium-editor-button-active')).toBe(true); fireEvent(button, 'click'); + + this.el.innerHTML = stripAttrIfEmpty(this.el, 'style'); + // style="text-decoration: line-through" prevents IE9+10 from doing anything when 'strikethrough' is triggered // but it should work in other browsers expect(!isOldIE() && button.classList.contains('medium-editor-button-active')).toBe(false); @@ -1056,3 +1068,14 @@ describe('Buttons TestCase', function () { }); }); }); + +function stripAttrIfEmpty(element, attribute) { + // we want to strip empty attributes (especially styles, + // because the tests create style tags, inject style content, + // and then remove that style content. + // + // some browsers will remove empty attributes automatically. + // + // others (Chrome, seemingly) will not: + return element.innerHTML.replace(attribute + '=""', ''); +} diff --git a/spec/content.spec.js b/spec/content.spec.js index 04d8b27a9..56f584c09 100644 --- a/spec/content.spec.js +++ b/spec/content.spec.js @@ -649,7 +649,7 @@ describe('Content TestCase', function () { fireEvent(target, 'keydown', { keyCode: MediumEditor.util.keyCode.BACKSPACE }); - expect(this.el.innerHTML).toBe('
lorem ipsum
lorem ipsum<\/p>