2015-06-01 21:25:38 +00:00
|
|
|
"use strict";
|
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
const assert = require( "assert" );
|
2015-06-01 21:25:38 +00:00
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
const ensureIterability = () => {
|
|
|
|
const { JSDOM } = require( "jsdom" );
|
2015-06-01 21:25:38 +00:00
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
const { window } = new JSDOM( "" );
|
2015-06-01 21:25:38 +00:00
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
let i;
|
|
|
|
const ensureJQuery = require( "./ensure_jquery" );
|
|
|
|
const jQuery = require( "../../../dist/jquery.js" )( window );
|
|
|
|
const elem = jQuery( "<div></div><span></span><a></a>" );
|
|
|
|
let result = "";
|
2015-06-01 21:25:38 +00:00
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
ensureJQuery( jQuery );
|
2015-06-01 21:25:38 +00:00
|
|
|
|
2019-03-04 17:30:51 +00:00
|
|
|
for ( i of elem ) {
|
|
|
|
result += i.nodeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.strictEqual( result, "DIVSPANA", "for-of works on jQuery objects" );
|
2015-06-01 21:25:38 +00:00
|
|
|
};
|
2019-03-04 17:30:51 +00:00
|
|
|
|
|
|
|
module.exports = ensureIterability;
|