|
@@ -78,23 +78,23 @@ describe( 'ImageTextAlternativeUI', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should set alt attribute value to textarea and select it', () => {
|
|
it( 'should set alt attribute value to textarea and select it', () => {
|
|
|
- const spy = sinon.spy( form.labeledInput, 'select' );
|
|
|
|
|
|
|
+ const spy = sinon.spy( form.labeledInput.field, 'select' );
|
|
|
|
|
|
|
|
setData( model, '[<image src="" alt="foo bar"></image>]' );
|
|
setData( model, '[<image src="" alt="foo bar"></image>]' );
|
|
|
|
|
|
|
|
button.fire( 'execute' );
|
|
button.fire( 'execute' );
|
|
|
sinon.assert.calledOnce( spy );
|
|
sinon.assert.calledOnce( spy );
|
|
|
- expect( form.labeledInput.value ).equals( 'foo bar' );
|
|
|
|
|
|
|
+ expect( form.labeledInput.field.value ).equals( 'foo bar' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should set empty text to textarea and select it when there is no alt attribute', () => {
|
|
it( 'should set empty text to textarea and select it when there is no alt attribute', () => {
|
|
|
- const spy = sinon.spy( form.labeledInput, 'select' );
|
|
|
|
|
|
|
+ const spy = sinon.spy( form.labeledInput.field, 'select' );
|
|
|
|
|
|
|
|
setData( model, '[<image src=""></image>]' );
|
|
setData( model, '[<image src=""></image>]' );
|
|
|
|
|
|
|
|
button.fire( 'execute' );
|
|
button.fire( 'execute' );
|
|
|
sinon.assert.calledOnce( spy );
|
|
sinon.assert.calledOnce( spy );
|
|
|
- expect( form.labeledInput.value ).equals( '' );
|
|
|
|
|
|
|
+ expect( form.labeledInput.field.value ).equals( '' );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -102,19 +102,18 @@ describe( 'ImageTextAlternativeUI', () => {
|
|
|
// https://github.com/ckeditor/ckeditor5-image/issues/114
|
|
// https://github.com/ckeditor/ckeditor5-image/issues/114
|
|
|
it( 'should make sure the input always stays in sync with the value of the command', () => {
|
|
it( 'should make sure the input always stays in sync with the value of the command', () => {
|
|
|
const button = editor.ui.componentFactory.create( 'imageTextAlternative' );
|
|
const button = editor.ui.componentFactory.create( 'imageTextAlternative' );
|
|
|
-
|
|
|
|
|
// Mock the value of the input after some past editing.
|
|
// Mock the value of the input after some past editing.
|
|
|
- form.labeledInput.value = 'foo';
|
|
|
|
|
|
|
+ form.labeledInput.field.value = 'foo';
|
|
|
|
|
|
|
|
// Mock the user using the form, changing the value but clicking "Cancel".
|
|
// Mock the user using the form, changing the value but clicking "Cancel".
|
|
|
// so the command's value is not updated.
|
|
// so the command's value is not updated.
|
|
|
- form.labeledInput.inputView.element.value = 'This value was canceled.';
|
|
|
|
|
|
|
+ form.labeledInput.field.element.value = 'This value was canceled.';
|
|
|
|
|
|
|
|
// Mock the user editing the same image once again.
|
|
// Mock the user editing the same image once again.
|
|
|
setData( model, '[<image src="" alt="foo"></image>]' );
|
|
setData( model, '[<image src="" alt="foo"></image>]' );
|
|
|
|
|
|
|
|
button.fire( 'execute' );
|
|
button.fire( 'execute' );
|
|
|
- expect( form.labeledInput.inputView.element.value ).to.equal( 'foo' );
|
|
|
|
|
|
|
+ expect( form.labeledInput.field.element.value ).to.equal( 'foo' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should execute command on submit', () => {
|
|
it( 'should execute command on submit', () => {
|
|
@@ -123,7 +122,7 @@ describe( 'ImageTextAlternativeUI', () => {
|
|
|
|
|
|
|
|
sinon.assert.calledOnce( spy );
|
|
sinon.assert.calledOnce( spy );
|
|
|
sinon.assert.calledWithExactly( spy, 'imageTextAlternative', {
|
|
sinon.assert.calledWithExactly( spy, 'imageTextAlternative', {
|
|
|
- newValue: form.labeledInput.inputView.element.value
|
|
|
|
|
|
|
+ newValue: form.labeledInput.field.element.value
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|