Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge 9562533 into 9a62cf1
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jul 9, 2018
2 parents 9a62cf1 + 9562533 commit f4f454c
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 6 deletions.
7 changes: 7 additions & 0 deletions tests/image.js
Expand Up @@ -12,11 +12,18 @@ import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-util
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
import global from '@ckeditor/ckeditor5-utils/src/dom/global';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'Image', () => {
let editorElement, model, view, editor, document, viewDocument;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

editorElement = global.document.createElement( 'div' );
global.document.body.appendChild( editorElement );

Expand Down
7 changes: 7 additions & 0 deletions tests/image/converters.js
Expand Up @@ -17,11 +17,18 @@ import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversio
import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import { setData as setModelData, getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'Image converters', () => {
let editor, model, document, viewDocument;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

return VirtualTestEditor.create()
.then( newEditor => {
editor = newEditor;
Expand Down
7 changes: 7 additions & 0 deletions tests/image/imageediting.js
Expand Up @@ -13,11 +13,18 @@ import { getData as getModelData, setData as setModelData } from '@ckeditor/cked
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import { isImageWidget } from '../../src/image/utils';
import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'ImageEditing', () => {
let editor, model, doc, view, viewDocument;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

return VirtualTestEditor
.create( {
plugins: [ ImageEditing ]
Expand Down
8 changes: 8 additions & 0 deletions tests/imagecaption/imagecaptionediting.js
Expand Up @@ -18,10 +18,18 @@ import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';

import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'ImageCaptionEditing', () => {
let editor, model, doc, view;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

return VirtualTestEditor
.create( {
plugins: [ ImageCaptionEditing, ImageEditing, UndoEditing, Paragraph ]
Expand Down
10 changes: 8 additions & 2 deletions tests/imagestyle/imagestyleediting.js
Expand Up @@ -12,12 +12,18 @@ import { getData as getModelData, setData as setModelData } from '@ckeditor/cked
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';

import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

testUtils.createSinonSandbox();
import env from '@ckeditor/ckeditor5-utils/src/env';

describe( 'ImageStyleEditing', () => {
let editor, model, document, viewDocument;

testUtils.createSinonSandbox( 'ImageStyleEditing' );

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
} );

afterEach( () => {
editor.destroy();
} );
Expand Down
4 changes: 2 additions & 2 deletions tests/imagestyle/utils.js
Expand Up @@ -13,11 +13,11 @@ import rightIcon from '@ckeditor/ckeditor5-core/theme/icons/object-right.svg';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import { normalizeImageStyles } from '../../src/imagestyle/utils';

testUtils.createSinonSandbox();

describe( 'ImageStyle utils', () => {
let imageStyles;

testUtils.createSinonSandbox();

describe( 'normalizeImageStyles()', () => {
// Since this function is all about normalizing the config object, make sure it doesn't throw
// if the config is empty (which may happen e.g. if only ImageStyleUI was loaded).
Expand Down
7 changes: 5 additions & 2 deletions tests/imagetextalternative/ui/textalternativeformview.js
Expand Up @@ -13,13 +13,16 @@ import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
import ViewCollection from '@ckeditor/ckeditor5-ui/src/viewcollection';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

testUtils.createSinonSandbox();
import env from '@ckeditor/ckeditor5-utils/src/env';

describe( 'TextAlternativeFormView', () => {
let view;

testUtils.createSinonSandbox();

beforeEach( () => {
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

view = new TextAlternativeFormView( { t: () => {} } );
} );

Expand Down
7 changes: 7 additions & 0 deletions tests/imagetoolbar.js
Expand Up @@ -15,11 +15,18 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Range from '@ckeditor/ckeditor5-engine/src/model/range';
import View from '@ckeditor/ckeditor5-ui/src/view';
import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'ImageToolbar', () => {
let editor, model, doc, plugin, toolbar, balloon, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

editorElement = global.document.createElement( 'div' );
global.document.body.appendChild( editorElement );

Expand Down
4 changes: 4 additions & 0 deletions tests/imageupload/imageuploadediting.js
Expand Up @@ -25,6 +25,7 @@ import Range from '@ckeditor/ckeditor5-engine/src/model/range';
import Position from '@ckeditor/ckeditor5-engine/src/model/position';

import log from '@ckeditor/ckeditor5-utils/src/log';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import Notification from '@ckeditor/ckeditor5-ui/src/notification/notification';

Expand All @@ -48,6 +49,9 @@ describe( 'ImageUploadEditing', () => {
}

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

testUtils.sinon.stub( window, 'FileReader' ).callsFake( () => {
nativeReaderMock = new NativeFileReaderMock();

Expand Down
3 changes: 3 additions & 0 deletions tests/imageupload/imageuploadprogress.js
Expand Up @@ -43,6 +43,9 @@ describe( 'ImageUploadProgress', () => {
testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

testUtils.sinon.stub( window, 'FileReader' ).callsFake( () => {
nativeReaderMock = new NativeFileReaderMock();

Expand Down
7 changes: 7 additions & 0 deletions tests/integration.js
Expand Up @@ -11,12 +11,19 @@ import global from '@ckeditor/ckeditor5-utils/src/dom/global';
import Image from '../src/image';
import ImageToolbar from '../src/imagetoolbar';
import View from '@ckeditor/ckeditor5-ui/src/view';
import env from '@ckeditor/ckeditor5-utils/src/env';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';

describe( 'ImageToolbar integration', () => {
describe( 'with the BalloonToolbar', () => {
let balloon, balloonToolbar, newEditor, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

editorElement = global.document.createElement( 'div' );
global.document.body.appendChild( editorElement );

Expand Down

0 comments on commit f4f454c

Please sign in to comment.