Skip to content

Commit

Permalink
Text fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Jul 9, 2015
1 parent d82b625 commit 86651c0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions demo/demo.js
Expand Up @@ -65,7 +65,7 @@ function readMobiledoc(string) {

function isValidJSON(string) {
try {
JSON.parse(string);
window.JSON.parse(string);
return true;
} catch(e) {
return false;
Expand Down Expand Up @@ -144,7 +144,7 @@ $(function() {
var mobiledoc = sampleMobiledocs.simpleMobiledoc;

var textarea = $('#mobiledoc-to-load textarea');
textarea.val(JSON.stringify(mobiledoc, false, 2));
textarea.val(window.JSON.stringify(mobiledoc, false, 2));

textarea.on('input', function() {
attemptEditorReboot(editor, textarea);
Expand All @@ -153,7 +153,7 @@ $(function() {
$('#select-mobiledoc').on('change', function() {
var mobiledocName = $(this).val();
var mobiledoc = sampleMobiledocs[mobiledocName];
textarea.val(JSON.stringify(mobiledoc, false, 2));
textarea.val(window.JSON.stringify(mobiledoc, false, 2));
textarea.trigger('input');
});

Expand Down
2 changes: 1 addition & 1 deletion server/services/embed.js
Expand Up @@ -14,7 +14,7 @@ module.exports = function(req, res) {

api.oembed({url: url}, function(err, objs) {
if (err) {
var message = JSON.parse(objs).error_message;
var message = window.JSON.parse(objs).error_message;
return res.status(500).json(message);
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/utils/http-utils.js
Expand Up @@ -35,7 +35,7 @@ function xhrPost(options) {
function responseJSON(jsonString) {
if (!jsonString) { return null; }
try {
return JSON.parse(jsonString);
return window.JSON.parse(jsonString);
} catch(e) {
return jsonString;
}
Expand Down
25 changes: 13 additions & 12 deletions tests/unit/editor/editor-test.js
Expand Up @@ -5,7 +5,7 @@ editorElement.className = 'editor';

import Editor from 'content-kit-editor/editor/editor';

const { module, test, asyncTest } = window.QUnit;
const { module, test } = window.QUnit;

module('Unit: Editor', {
setup: function() {
Expand All @@ -16,31 +16,32 @@ module('Unit: Editor', {
}
});

test('can create an editor via dom node reference', function() {
test('can create an editor via dom node reference', (assert) => {
var editor = new Editor(editorElement);
equal(editor.element, editorElement);
assert.equal(editor.element, editorElement);
});

test('can create an editor via dom node reference from getElementById', function() {
test('can create an editor via dom node reference from getElementById', (assert) => {
var editor = new Editor(document.getElementById('editor1'));
equal(editor.element, editorElement);
assert.equal(editor.element, editorElement);
});

test('creating an editor without a class name adds appropriate class', function() {
test('creating an editor without a class name adds appropriate class', (assert) => {
editorElement.className = '';

var editor = new Editor(document.getElementById('editor1'));
equal(editor.element.className, 'ck-editor');
assert.equal(editor.element.className, 'ck-editor');
});

asyncTest('editor fires update event', function() {
expect(2);
test('editor fires update event', (assert) => {
assert.expect(2);
let done = assert.async();

var editor = new Editor(editorElement);
editor.on('update', function(data) {
equal (this, editor);
equal (data.index, 99);
start();
assert.equal(this, editor);
assert.equal(data.index, 99);
done();
});
editor.trigger('update', { index: 99 });
});
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/renderers/mobiledoc-test.js
Expand Up @@ -6,7 +6,7 @@ const render = MobiledocRenderer.render;
let builder;


QUnit.module('Unit: Mobiledoc Renderer', {
module('Unit: Mobiledoc Renderer', {
beforeEach() {
builder = generateBuilder();
}
Expand Down

0 comments on commit 86651c0

Please sign in to comment.