Skip to content

Commit

Permalink
Tests: Fix the jQuery.parseXML error reporting test
Browse files Browse the repository at this point in the history
Changes:
* Remove incorrect `QUnit.testUnlessIE` usage as that util is only available
  on `master`, not here.
* Change `firstCall.lastArg` to `firstCall.args[ 0 ]` as the former API is not
  available in older Sinon versions.
  • Loading branch information
mgol committed Dec 8, 2020
1 parent 54d9883 commit 1ec3633
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1432,15 +1432,17 @@ QUnit.test( "jQuery.parseXML", function( assert ) {
// Support: IE 11+
// IE throws an error when parsing invalid XML instead of reporting the error
// in a `parsererror` element, skip the test there.
QUnit.testUnlessIE( "jQuery.parseXML - error reporting", function( assert ) {
QUnit[
document.documentMode ? "skip" : "test"
]( "jQuery.parseXML - error reporting", function( assert ) {
assert.expect( 2 );

var errorArg, lineMatch, line, columnMatch, column;

sinon.stub( jQuery, "error" );

jQuery.parseXML( "<p>Not a <<b>well-formed</b> xml string</p>" );
errorArg = jQuery.error.firstCall.lastArg.toLowerCase();
errorArg = jQuery.error.firstCall.args[ 0 ].toLowerCase();
console.log( "errorArg", errorArg );

lineMatch = errorArg.match( /line\s*(?:number)?\s*(\d+)/ );
Expand Down

0 comments on commit 1ec3633

Please sign in to comment.