From 65f41762499ce3b924e52cfb16a069ffbc36521f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 28 Oct 2015 09:23:28 -0400 Subject: [PATCH] Checkboxradio: Fix error tests with jQuery 1.7.0 --- tests/unit/checkboxradio/core.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/unit/checkboxradio/core.js b/tests/unit/checkboxradio/core.js index ac4f2705a..15cfc155b 100644 --- a/tests/unit/checkboxradio/core.js +++ b/tests/unit/checkboxradio/core.js @@ -72,25 +72,28 @@ test( "Checkbox creation requires a label, and finds it in all cases", function( test( "Calling checkboxradio on an unsupported element throws an error", function( assert ) { expect( 2 ); - var error = new Error( - "Can't create checkboxradio on element.nodeName=div and element.type=undefined" - ); + var errorMessage = + "Can't create checkboxradio on element.nodeName=div and element.type=undefined"; + var error = new Error( errorMessage ); assert.raises( function() { $( "
" ).checkboxradio(); }, - error, + + // Support: jQuery 1.7.0 only + $.fn.jquery === "1.7" ? errorMessage : error, "Proper error thrown" ); - error = new Error( - "Can't create checkboxradio on element.nodeName=input and element.type=button" - ); + errorMessage = "Can't create checkboxradio on element.nodeName=input and element.type=button"; + error = new Error( errorMessage ); assert.raises( function() { $( "" ).checkboxradio(); }, - error, + + // Support: jQuery 1.7.0 only + $.fn.jquery === "1.7" ? errorMessage : error, "Proper error thrown" ); } ); @@ -98,12 +101,15 @@ test( "Calling checkboxradio on an unsupported element throws an error", functio test( "Calling checkboxradio on an input with no label throws an error", function( assert ) { expect( 1 ); - var error = new Error( "No label found for checkboxradio widget" ); + var errorMessage = "No label found for checkboxradio widget"; + var error = new Error( errorMessage ); assert.raises( function() { $( "" ).checkboxradio(); }, - error, + + // Support: jQuery 1.7.0 only + $.fn.jquery === "1.7" ? errorMessage : error, "Proper error thrown" ); } ); -- 2.39.5