From 9027df0c9a613242fdf7510c35b72359dc4aaa33 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 29 Oct 2015 08:37:43 -0700 Subject: [PATCH 1/5] Failing test for #520 --- js-tests/build/specs.js | 17 +++++++++++++++++ js-tests/src/shortcodeViewConstructorSpec.js | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/js-tests/build/specs.js b/js-tests/build/specs.js index ac899ef4..18b78a2d 100644 --- a/js-tests/build/specs.js +++ b/js-tests/build/specs.js @@ -198,6 +198,23 @@ describe( 'Shortcode View Constructor', function(){ var shortcode = ShortcodeViewConstructor.parseShortcodeString( '[no_custom_attribute foo="bar" bar="banana"]' ); var _shortcode = $.extend( true, {}, shortcode ); expect( _shortcode.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); + ShortcodeViewConstructor.shortcode = { + 'type' : 'single', + 'tag' : 'no_custom_attribute', + 'attrs' : { + 'named' : { + 'foo' : 'bar', + 'bar' : 'banana', + }, + 'numeric' : [], + }, + }; + var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; + ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { + return new $.Deferred(); + } + ShortcodeViewConstructor.initialize(); + expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); }); it( 'Reverses the effect of core adding wpautop to shortcode inner content', function(){ diff --git a/js-tests/src/shortcodeViewConstructorSpec.js b/js-tests/src/shortcodeViewConstructorSpec.js index 4ba03f70..51a3de93 100644 --- a/js-tests/src/shortcodeViewConstructorSpec.js +++ b/js-tests/src/shortcodeViewConstructorSpec.js @@ -41,6 +41,23 @@ describe( 'Shortcode View Constructor', function(){ var shortcode = ShortcodeViewConstructor.parseShortcodeString( '[no_custom_attribute foo="bar" bar="banana"]' ); var _shortcode = $.extend( true, {}, shortcode ); expect( _shortcode.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); + ShortcodeViewConstructor.shortcode = { + 'type' : 'single', + 'tag' : 'no_custom_attribute', + 'attrs' : { + 'named' : { + 'foo' : 'bar', + 'bar' : 'banana', + }, + 'numeric' : [], + }, + }; + var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; + ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { + return new $.Deferred(); + } + ShortcodeViewConstructor.initialize(); + expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); }); it( 'Reverses the effect of core adding wpautop to shortcode inner content', function(){ From 33b43a049f6728008627ee481fa72d3f27127a09 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 29 Oct 2015 08:40:22 -0700 Subject: [PATCH 2/5] Failing test for backing up `inner_content` too --- js-tests/build/specs.js | 17 +++++++++++++++++ js-tests/src/shortcodeViewConstructorSpec.js | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/js-tests/build/specs.js b/js-tests/build/specs.js index 18b78a2d..8ae07d74 100644 --- a/js-tests/build/specs.js +++ b/js-tests/build/specs.js @@ -180,6 +180,23 @@ describe( 'Shortcode View Constructor', function(){ var shortcode = ShortcodeViewConstructor.parseShortcodeString( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); var _shortcode = $.extend( true, {}, shortcode ); expect( _shortcode.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); + ShortcodeViewConstructor.shortcode = { + 'type' : 'single', + 'tag' : 'no_inner_content', + 'attrs' : { + 'named' : { + 'foo' : 'bar', + }, + 'numeric' : [], + }, + 'content' : 'burrito' + }; + var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; + ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { + return new $.Deferred(); + } + ShortcodeViewConstructor.initialize(); + expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); }); it( 'Persists custom attribute when parsing a shortcode without the attribute defined in UI', function() { diff --git a/js-tests/src/shortcodeViewConstructorSpec.js b/js-tests/src/shortcodeViewConstructorSpec.js index 51a3de93..55db7c32 100644 --- a/js-tests/src/shortcodeViewConstructorSpec.js +++ b/js-tests/src/shortcodeViewConstructorSpec.js @@ -23,6 +23,23 @@ describe( 'Shortcode View Constructor', function(){ var shortcode = ShortcodeViewConstructor.parseShortcodeString( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); var _shortcode = $.extend( true, {}, shortcode ); expect( _shortcode.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); + ShortcodeViewConstructor.shortcode = { + 'type' : 'single', + 'tag' : 'no_inner_content', + 'attrs' : { + 'named' : { + 'foo' : 'bar', + }, + 'numeric' : [], + }, + 'content' : 'burrito' + }; + var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; + ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { + return new $.Deferred(); + } + ShortcodeViewConstructor.initialize(); + expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); }); it( 'Persists custom attribute when parsing a shortcode without the attribute defined in UI', function() { From 115c323e39eee1f465488c05fb9c6fa818ff3213 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 29 Oct 2015 08:53:21 -0700 Subject: [PATCH 3/5] Put `parseShortcodeString()`'s model-generation logic into `getShortcodeModel()` The previous code wasn't very DRY, and had buggy inconsistencies. `getShortcodeModel()` now properly interprets registered and unregistered attributes and content --- js-tests/build/specs.js | 93 +++++++------------- js-tests/src/shortcodeViewConstructorSpec.js | 5 ++ js/build/shortcode-ui.js | 88 ++++++------------ js/src/utils/shortcode-view-constructor.js | 88 ++++++------------ 4 files changed, 94 insertions(+), 180 deletions(-) diff --git a/js-tests/build/specs.js b/js-tests/build/specs.js index 8ae07d74..0d227967 100644 --- a/js-tests/build/specs.js +++ b/js-tests/build/specs.js @@ -239,6 +239,10 @@ describe( 'Shortcode View Constructor', function(){ tag: 'pullquote', content: 'This quote has

\n

Multiple line breaks two

\n

Test one', type: 'closed', + attrs: { + named: {}, + numeric: [], + } }; var data = { label: 'Pullquote', @@ -259,6 +263,7 @@ describe( 'Shortcode View Constructor', function(){ }, }, type: 'single', + content: null, }; var data = { label: 'Pullquote', @@ -855,11 +860,10 @@ var shortcodeViewConstructor = { * values. * * @this {Shortcode} - * @param {Object} options Options + * @param {Object} options Options formatted as wp.shortcode. */ getShortcodeModel: function( options ) { - var shortcodeModel, - self = this; + var shortcodeModel; shortcodeModel = sui.shortcodes.findWhere( { shortcode_tag: options.tag } ); @@ -867,38 +871,42 @@ var shortcodeViewConstructor = { return; } - shortcodeModel = shortcodeModel.clone(); + currentShortcode = shortcodeModel.clone(); - shortcodeModel.get('attrs').each( function( attr ) { + var attributes_backup = {}; + var attributes = options.attrs; + for ( var key in attributes.named ) { - // Verify value exists for attribute. - if ( ! ( attr.get('attr') in options.attrs.named ) ) { - return; + if ( ! attributes.named.hasOwnProperty( key ) ) { + continue; } - var value = options.attrs.named[ attr.get('attr') ]; - - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - value = self.unAutoP( value ); + value = attributes.named[ key ]; + attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - // Maybe decode value. - if ( attr.get('encode') ) { + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } - attr.set( 'value', value ); - } ); + if ( attr ) { + attr.set( 'value', value ); + } else { + attributes_backup[ key ] = value; + } + } - if ( 'content' in options ) { - var innerContent = shortcodeModel.get('inner_content'); - if ( innerContent ) { - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - options.content = self.unAutoP( options.content ); - innerContent.set('value', options.content ); + currentShortcode.set( 'attributes_backup', attributes_backup ); + + if ( options.content ) { + var inner_content = currentShortcode.get( 'inner_content' ); + if ( inner_content ) { + inner_content.set( 'value', this.unAutoP( options.content ) ); + } else { + currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); } } - return shortcodeModel; + return currentShortcode; }, /** @@ -1005,43 +1013,8 @@ var shortcodeViewConstructor = { return; } - currentShortcode = defaultShortcode.clone(); - - var attributes_backup = {}; - var attributes = wp.shortcode.attrs( matches[3] ); - - for ( var key in attributes.named ) { - - if ( ! attributes.named.hasOwnProperty( key ) ) { - continue; - } - - value = attributes.named[ key ]; - attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - - if ( attr && attr.get('encode') ) { - value = decodeURIComponent( value ); - } - - if ( attr ) { - attr.set( 'value', value ); - } else { - attributes_backup[ key ] = value; - } - } - - currentShortcode.set( 'attributes_backup', attributes_backup ); - - if ( matches[5] ) { - var inner_content = currentShortcode.get( 'inner_content' ); - if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( matches[5] ) ); - } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( matches[5] ) ); - } - } - - return currentShortcode; + var shortcode = wp.shortcode.fromMatch( matches ); + return this.getShortcodeModel( shortcode ); }, /** diff --git a/js-tests/src/shortcodeViewConstructorSpec.js b/js-tests/src/shortcodeViewConstructorSpec.js index 55db7c32..169740ef 100644 --- a/js-tests/src/shortcodeViewConstructorSpec.js +++ b/js-tests/src/shortcodeViewConstructorSpec.js @@ -82,6 +82,10 @@ describe( 'Shortcode View Constructor', function(){ tag: 'pullquote', content: 'This quote has

\n

Multiple line breaks two

\n

Test one', type: 'closed', + attrs: { + named: {}, + numeric: [], + } }; var data = { label: 'Pullquote', @@ -102,6 +106,7 @@ describe( 'Shortcode View Constructor', function(){ }, }, type: 'single', + content: null, }; var data = { label: 'Pullquote', diff --git a/js/build/shortcode-ui.js b/js/build/shortcode-ui.js index a5b3a4e2..8f3b5221 100644 --- a/js/build/shortcode-ui.js +++ b/js/build/shortcode-ui.js @@ -454,11 +454,10 @@ var shortcodeViewConstructor = { * values. * * @this {Shortcode} - * @param {Object} options Options + * @param {Object} options Options formatted as wp.shortcode. */ getShortcodeModel: function( options ) { - var shortcodeModel, - self = this; + var shortcodeModel; shortcodeModel = sui.shortcodes.findWhere( { shortcode_tag: options.tag } ); @@ -466,38 +465,42 @@ var shortcodeViewConstructor = { return; } - shortcodeModel = shortcodeModel.clone(); + currentShortcode = shortcodeModel.clone(); - shortcodeModel.get('attrs').each( function( attr ) { + var attributes_backup = {}; + var attributes = options.attrs; + for ( var key in attributes.named ) { - // Verify value exists for attribute. - if ( ! ( attr.get('attr') in options.attrs.named ) ) { - return; + if ( ! attributes.named.hasOwnProperty( key ) ) { + continue; } - var value = options.attrs.named[ attr.get('attr') ]; - - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - value = self.unAutoP( value ); + value = attributes.named[ key ]; + attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - // Maybe decode value. - if ( attr.get('encode') ) { + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } - attr.set( 'value', value ); - } ); + if ( attr ) { + attr.set( 'value', value ); + } else { + attributes_backup[ key ] = value; + } + } - if ( 'content' in options ) { - var innerContent = shortcodeModel.get('inner_content'); - if ( innerContent ) { - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - options.content = self.unAutoP( options.content ); - innerContent.set('value', options.content ); + currentShortcode.set( 'attributes_backup', attributes_backup ); + + if ( options.content ) { + var inner_content = currentShortcode.get( 'inner_content' ); + if ( inner_content ) { + inner_content.set( 'value', this.unAutoP( options.content ) ); + } else { + currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); } } - return shortcodeModel; + return currentShortcode; }, /** @@ -604,43 +607,8 @@ var shortcodeViewConstructor = { return; } - currentShortcode = defaultShortcode.clone(); - - var attributes_backup = {}; - var attributes = wp.shortcode.attrs( matches[3] ); - - for ( var key in attributes.named ) { - - if ( ! attributes.named.hasOwnProperty( key ) ) { - continue; - } - - value = attributes.named[ key ]; - attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - - if ( attr && attr.get('encode') ) { - value = decodeURIComponent( value ); - } - - if ( attr ) { - attr.set( 'value', value ); - } else { - attributes_backup[ key ] = value; - } - } - - currentShortcode.set( 'attributes_backup', attributes_backup ); - - if ( matches[5] ) { - var inner_content = currentShortcode.get( 'inner_content' ); - if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( matches[5] ) ); - } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( matches[5] ) ); - } - } - - return currentShortcode; + var shortcode = wp.shortcode.fromMatch( matches ); + return this.getShortcodeModel( shortcode ); }, /** diff --git a/js/src/utils/shortcode-view-constructor.js b/js/src/utils/shortcode-view-constructor.js index 43e2de91..e314b00d 100644 --- a/js/src/utils/shortcode-view-constructor.js +++ b/js/src/utils/shortcode-view-constructor.js @@ -55,11 +55,10 @@ var shortcodeViewConstructor = { * values. * * @this {Shortcode} - * @param {Object} options Options + * @param {Object} options Options formatted as wp.shortcode. */ getShortcodeModel: function( options ) { - var shortcodeModel, - self = this; + var shortcodeModel; shortcodeModel = sui.shortcodes.findWhere( { shortcode_tag: options.tag } ); @@ -67,38 +66,42 @@ var shortcodeViewConstructor = { return; } - shortcodeModel = shortcodeModel.clone(); + currentShortcode = shortcodeModel.clone(); - shortcodeModel.get('attrs').each( function( attr ) { + var attributes_backup = {}; + var attributes = options.attrs; + for ( var key in attributes.named ) { - // Verify value exists for attribute. - if ( ! ( attr.get('attr') in options.attrs.named ) ) { - return; + if ( ! attributes.named.hasOwnProperty( key ) ) { + continue; } - var value = options.attrs.named[ attr.get('attr') ]; - - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - value = self.unAutoP( value ); + value = attributes.named[ key ]; + attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - // Maybe decode value. - if ( attr.get('encode') ) { + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } - attr.set( 'value', value ); - } ); + if ( attr ) { + attr.set( 'value', value ); + } else { + attributes_backup[ key ] = value; + } + } - if ( 'content' in options ) { - var innerContent = shortcodeModel.get('inner_content'); - if ( innerContent ) { - // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 - options.content = self.unAutoP( options.content ); - innerContent.set('value', options.content ); + currentShortcode.set( 'attributes_backup', attributes_backup ); + + if ( options.content ) { + var inner_content = currentShortcode.get( 'inner_content' ); + if ( inner_content ) { + inner_content.set( 'value', this.unAutoP( options.content ) ); + } else { + currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); } } - return shortcodeModel; + return currentShortcode; }, /** @@ -205,43 +208,8 @@ var shortcodeViewConstructor = { return; } - currentShortcode = defaultShortcode.clone(); - - var attributes_backup = {}; - var attributes = wp.shortcode.attrs( matches[3] ); - - for ( var key in attributes.named ) { - - if ( ! attributes.named.hasOwnProperty( key ) ) { - continue; - } - - value = attributes.named[ key ]; - attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); - - if ( attr && attr.get('encode') ) { - value = decodeURIComponent( value ); - } - - if ( attr ) { - attr.set( 'value', value ); - } else { - attributes_backup[ key ] = value; - } - } - - currentShortcode.set( 'attributes_backup', attributes_backup ); - - if ( matches[5] ) { - var inner_content = currentShortcode.get( 'inner_content' ); - if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( matches[5] ) ); - } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( matches[5] ) ); - } - } - - return currentShortcode; + var shortcode = wp.shortcode.fromMatch( matches ); + return this.getShortcodeModel( shortcode ); }, /** From a607644af7f5cda0d93ebb2acd3ae6ead101a191 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 29 Oct 2015 08:57:31 -0700 Subject: [PATCH 4/5] Restore unAutoP behavior --- js-tests/build/specs.js | 9 +++++++-- js/build/shortcode-ui.js | 9 +++++++-- js/src/utils/shortcode-view-constructor.js | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/js-tests/build/specs.js b/js-tests/build/specs.js index 0d227967..7c3a5176 100644 --- a/js-tests/build/specs.js +++ b/js-tests/build/specs.js @@ -884,6 +884,9 @@ var shortcodeViewConstructor = { value = attributes.named[ key ]; attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + value = this.unAutoP( value ); + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } @@ -899,10 +902,12 @@ var shortcodeViewConstructor = { if ( options.content ) { var inner_content = currentShortcode.get( 'inner_content' ); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + options.content = this.unAutoP( options.content ); if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( options.content ) ); + inner_content.set( 'value', options.content ); } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); + currentShortcode.set( 'inner_content_backup', options.content ); } } diff --git a/js/build/shortcode-ui.js b/js/build/shortcode-ui.js index 8f3b5221..610f3662 100644 --- a/js/build/shortcode-ui.js +++ b/js/build/shortcode-ui.js @@ -478,6 +478,9 @@ var shortcodeViewConstructor = { value = attributes.named[ key ]; attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + value = this.unAutoP( value ); + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } @@ -493,10 +496,12 @@ var shortcodeViewConstructor = { if ( options.content ) { var inner_content = currentShortcode.get( 'inner_content' ); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + options.content = this.unAutoP( options.content ); if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( options.content ) ); + inner_content.set( 'value', options.content ); } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); + currentShortcode.set( 'inner_content_backup', options.content ); } } diff --git a/js/src/utils/shortcode-view-constructor.js b/js/src/utils/shortcode-view-constructor.js index e314b00d..c5f83ca7 100644 --- a/js/src/utils/shortcode-view-constructor.js +++ b/js/src/utils/shortcode-view-constructor.js @@ -79,6 +79,9 @@ var shortcodeViewConstructor = { value = attributes.named[ key ]; attr = currentShortcode.get( 'attrs' ).findWhere({ attr: key }); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + value = this.unAutoP( value ); + if ( attr && attr.get('encode') ) { value = decodeURIComponent( value ); } @@ -94,10 +97,12 @@ var shortcodeViewConstructor = { if ( options.content ) { var inner_content = currentShortcode.get( 'inner_content' ); + // Reverse the effects of wpautop: https://core.trac.wordpress.org/ticket/34329 + options.content = this.unAutoP( options.content ); if ( inner_content ) { - inner_content.set( 'value', this.unAutoP( options.content ) ); + inner_content.set( 'value', options.content ); } else { - currentShortcode.set( 'inner_content_backup', this.unAutoP( options.content ) ); + currentShortcode.set( 'inner_content_backup', options.content ); } } From d9a8bb11dc29dd70b99cf0fbe19b5e9ae791868e Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 29 Oct 2015 08:57:56 -0700 Subject: [PATCH 5/5] Fix JS lint --- js-tests/build/specs.js | 4 ++-- js-tests/src/shortcodeViewConstructorSpec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js-tests/build/specs.js b/js-tests/build/specs.js index 7c3a5176..3ac4a4d3 100644 --- a/js-tests/build/specs.js +++ b/js-tests/build/specs.js @@ -194,7 +194,7 @@ describe( 'Shortcode View Constructor', function(){ var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { return new $.Deferred(); - } + }; ShortcodeViewConstructor.initialize(); expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); }); @@ -229,7 +229,7 @@ describe( 'Shortcode View Constructor', function(){ var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { return new $.Deferred(); - } + }; ShortcodeViewConstructor.initialize(); expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); }); diff --git a/js-tests/src/shortcodeViewConstructorSpec.js b/js-tests/src/shortcodeViewConstructorSpec.js index 169740ef..ed3c1297 100644 --- a/js-tests/src/shortcodeViewConstructorSpec.js +++ b/js-tests/src/shortcodeViewConstructorSpec.js @@ -37,7 +37,7 @@ describe( 'Shortcode View Constructor', function(){ var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { return new $.Deferred(); - } + }; ShortcodeViewConstructor.initialize(); expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_inner_content foo="bar"]burrito[/no_inner_content]' ); }); @@ -72,7 +72,7 @@ describe( 'Shortcode View Constructor', function(){ var ShortcodeViewConstructorWithoutFetch = ShortcodeViewConstructor; ShortcodeViewConstructorWithoutFetch.delayedFetch = function() { return new $.Deferred(); - } + }; ShortcodeViewConstructor.initialize(); expect( ShortcodeViewConstructor.shortcodeModel.formatShortcode() ).toEqual( '[no_custom_attribute foo="bar" bar="banana"]' ); });