|
@@ -43,7 +43,9 @@ describe( 'attachToForm()', () => {
|
|
|
submitStub.restore();
|
|
submitStub.restore();
|
|
|
form.remove();
|
|
form.remove();
|
|
|
|
|
|
|
|
- return editor.destroy();
|
|
|
|
|
|
|
+ if ( editor ) {
|
|
|
|
|
+ return editor.destroy();
|
|
|
|
|
+ }
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should throw an error when is used with editor without `ElementApiMixin`', () => {
|
|
it( 'should throw an error when is used with editor without `ElementApiMixin`', () => {
|
|
@@ -126,6 +128,7 @@ describe( 'attachToForm()', () => {
|
|
|
expect( textarea.value ).to.equal( '' );
|
|
expect( textarea.value ).to.equal( '' );
|
|
|
|
|
|
|
|
return editor.destroy().then( () => {
|
|
return editor.destroy().then( () => {
|
|
|
|
|
+ editor = null;
|
|
|
// Submit method is no longer replaced by our implementation.
|
|
// Submit method is no longer replaced by our implementation.
|
|
|
expect( form.submit ).to.equal( submitStub );
|
|
expect( form.submit ).to.equal( submitStub );
|
|
|
form.submit();
|
|
form.submit();
|
|
@@ -141,6 +144,8 @@ describe( 'attachToForm()', () => {
|
|
|
expect( textarea.value ).to.equal( '' );
|
|
expect( textarea.value ).to.equal( '' );
|
|
|
|
|
|
|
|
return editor.destroy().then( () => {
|
|
return editor.destroy().then( () => {
|
|
|
|
|
+ editor = null;
|
|
|
|
|
+
|
|
|
form.dispatchEvent( new Event( 'submit', {
|
|
form.dispatchEvent( new Event( 'submit', {
|
|
|
// We need to be able to do preventDefault() to prevent page reloads in Firefox.
|
|
// We need to be able to do preventDefault() to prevent page reloads in Firefox.
|
|
|
cancelable: true
|
|
cancelable: true
|
|
@@ -172,6 +177,8 @@ describe( 'attachToForm()', () => {
|
|
|
expect( textarea.value ).to.equal( 'foo bar' );
|
|
expect( textarea.value ).to.equal( 'foo bar' );
|
|
|
|
|
|
|
|
return editor.destroy().then( () => {
|
|
return editor.destroy().then( () => {
|
|
|
|
|
+ editor = null;
|
|
|
|
|
+
|
|
|
expect( form.submit ).to.equal( input );
|
|
expect( form.submit ).to.equal( input );
|
|
|
input.remove();
|
|
input.remove();
|
|
|
} );
|
|
} );
|