From 0c7646dea80b7fc06256d91022282bc399c6cdeb Mon Sep 17 00:00:00 2001 From: Ryan McCarvill Date: Wed, 1 Mar 2017 21:33:22 +1300 Subject: [PATCH] removed tests --- ghost/admin/lib/ghost-editor/package.json | 6 +- ghost/admin/lib/ghost-editor/tests/README | 1 + .../ghost-editor/tests/integration/.gitkeep | 0 .../components/ghost-editor-test.js | 193 ------------------ ghost/admin/lib/ghost-editor/tests/todo.txt | 2 - .../lib/ghost-editor/tests/unit/.gitkeep | 0 6 files changed, 3 insertions(+), 199 deletions(-) create mode 100644 ghost/admin/lib/ghost-editor/tests/README delete mode 100644 ghost/admin/lib/ghost-editor/tests/integration/.gitkeep delete mode 100644 ghost/admin/lib/ghost-editor/tests/integration/components/ghost-editor-test.js delete mode 100644 ghost/admin/lib/ghost-editor/tests/todo.txt delete mode 100644 ghost/admin/lib/ghost-editor/tests/unit/.gitkeep diff --git a/ghost/admin/lib/ghost-editor/package.json b/ghost/admin/lib/ghost-editor/package.json index 5d5c4f896d..08d13ce43e 100644 --- a/ghost/admin/lib/ghost-editor/package.json +++ b/ghost/admin/lib/ghost-editor/package.json @@ -3,13 +3,11 @@ "version": "0.1.10", "description": "A mobiledoc-kit based editor for Ghost. WARNING DO NOT USE!", "directories": { - "doc": "doc", - "test": "tests" + "doc": "doc" }, "scripts": { "build": "ember build", - "start": "ember server", - "test": "ember try:each" + "start": "ember server" }, "repository": "", "engines": { diff --git a/ghost/admin/lib/ghost-editor/tests/README b/ghost/admin/lib/ghost-editor/tests/README new file mode 100644 index 0000000000..64343c3189 --- /dev/null +++ b/ghost/admin/lib/ghost-editor/tests/README @@ -0,0 +1 @@ +The tests are now located in the main ghost-admin repository. diff --git a/ghost/admin/lib/ghost-editor/tests/integration/.gitkeep b/ghost/admin/lib/ghost-editor/tests/integration/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ghost/admin/lib/ghost-editor/tests/integration/components/ghost-editor-test.js b/ghost/admin/lib/ghost-editor/tests/integration/components/ghost-editor-test.js deleted file mode 100644 index 3f88cb4b2e..0000000000 --- a/ghost/admin/lib/ghost-editor/tests/integration/components/ghost-editor-test.js +++ /dev/null @@ -1,193 +0,0 @@ -import { moduleForComponent, test } from 'ember-qunit'; -import hbs from 'htmlbars-inline-precompile'; -import wait from 'ember-test-helpers/wait'; -import startApp from '../../helpers/start-app'; -import Ember from 'ember'; -// import { Position, Range } from 'mobiledoc-kit/utils/cursor'; -let App; -moduleForComponent('ghost-editor', 'Integration | Component | ghost editor', { - integration: true, - setup: function() { - App = startApp(); - }, - teardown: function() { - Ember.run(App, 'destroy'); - } -}); - - -const blankDoc = {version:"0.3.0",atoms:[],cards:[],markups:[],sections:[[1,"p",[[0,[],0,""]]]]}; - -test('it renders', function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... }); - - - assert.expect(2); - - this.set('mobiledoc', blankDoc); - this.render(hbs`{{ghost-editor value=mobiledoc}}`); - - assert.ok( - this.$('.surface').prop('contenteditable'), - 'editor is created' - ); - - - let editor = window.editor; - return wait().then(() => { - return selectRangeWithEditor(editor, editor.post.tailPosition()); - }).then(() => { - Ember.run(() => editor.insertText('abcdef')); - return wait(); - }).then(() => { - assert.equal('abcdef', $('.surface')[0].childNodes[0].innerHTML, 'editor renders changes into the dom'); - }); -}); - -test('inline markdown support', function(assert) { - assert.expect(14); - - this.set('mobiledoc', blankDoc); - this.render(hbs`{{ghost-editor value=mobiledoc}}`); - - - let editor = window.editor; - return wait().then(() => { - return selectRangeWithEditor(editor, editor.post.tailPosition()); - }).then(() => { - return clearEditorAndInputText(editor, '**test**'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '** markdown bolds at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123**test**'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '** markdown bolds in line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '__test__'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '__ markdown bolds at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123__test__'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '__ markdown bolds in line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '*test*'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '* markdown emphasises at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123*test*'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '* markdown emphasises in line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '_test_'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '_ markdown emphasises at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123_test_'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '_ markdown emphasises in line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '**test*'); - }).then(() => { - assert.equal('**test*', $('.surface')[0].childNodes[0].innerHTML, 'two ** at the start and one * at the end (mixing strong and em) doesn\'t render'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '__test_'); - }).then(() => { - assert.equal('__test_', $('.surface')[0].childNodes[0].innerHTML, 'two __ at the start and one _ at the end (mixing strong and em) doesn\'t render'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '~~test~~'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '~~ markdown strikethroughs at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123~~test~~'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '~~ markdown strikethroughs in line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '[http://www.ghost.org/](Ghost)'); - }).then(() => { - assert.equal('http://www.ghost.org/', $('.surface')[0].childNodes[0].innerHTML, 'creates a link at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123[http://www.ghost.org/](Ghost)'); - }).then(() => { - assert.equal('123http://www.ghost.org/', $('.surface')[0].childNodes[0].innerHTML, 'creates a link in line'); - return wait(); - }); -}); - -test('block markdown support', function(assert) { - assert.expect(2); - - this.set('mobiledoc', blankDoc); - this.render(hbs`{{ghost-editor value=mobiledoc}}`); - - //1., *, #, ##, and ### are all tested within mobiledoc - - let editor = window.editor; - return wait().then(() => { - return selectRangeWithEditor(editor, editor.post.tailPosition()); - }).then(() => { - return clearEditorAndInputText(editor, '- '); - }).then(() => { - assert.equal('', $('.surface')[0].innerHTML, '- creates a list'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '> '); - }).then(() => { - assert.equal('

', $('.surface')[0].innerHTML, '> creates a pullquote'); - return wait(); - }); -}); - -/* -test('card markdown support', function(assert) { - assert.expect(2); - - this.set('mobiledoc', blankDoc); - this.render(hbs`{{ghost-editor value=mobiledoc}}`); - //![](), ``` - - let editor = window.editor; - return wait().then(() => { - return selectRangeWithEditor(editor, editor.post.tailPosition()); - }).then(() => { - return clearEditorAndInputText(editor, '**test**'); - }).then(() => { - assert.equal('test', $('.surface')[0].childNodes[0].innerHTML, '** markdown bolds at start of line'); - return wait(); - }).then(() => { - return clearEditorAndInputText(editor, '123**test**'); - }).then(() => { - assert.equal('123test', $('.surface')[0].childNodes[0].innerHTML, '** markdown bolds in line'); - return wait(); - }) - ; -}); -*/ - -let runLater = (cb) => window.requestAnimationFrame(cb); -function selectRangeWithEditor(editor, range) { - editor.selectRange(range); - return new Ember.RSVP.Promise(resolve => runLater(resolve)); -} - -function clearEditorAndInputText(editor, text) { - editor.run(postEditor => { - postEditor.deleteRange(editor.post.toRange()); - }); - editor._eventManager._textInputHandler.handle(text); - return wait(); -} diff --git a/ghost/admin/lib/ghost-editor/tests/todo.txt b/ghost/admin/lib/ghost-editor/tests/todo.txt deleted file mode 100644 index e0ad9e670d..0000000000 --- a/ghost/admin/lib/ghost-editor/tests/todo.txt +++ /dev/null @@ -1,2 +0,0 @@ -slashmenu: - when close restore keys diff --git a/ghost/admin/lib/ghost-editor/tests/unit/.gitkeep b/ghost/admin/lib/ghost-editor/tests/unit/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000