3 const assert = require( "node:assert/strict" );
4 const { JSDOM } = require( "jsdom" );
6 const { ensureJQuery } = require( "./ensure_jquery.cjs" );
8 const ensureIterability = ( jQueryModuleSpecifier ) => {
9 const { window } = new JSDOM( "" );
11 const { jQueryFactory } = require( jQueryModuleSpecifier );
12 const jQuery = jQueryFactory( window );
13 const elem = jQuery( "<div></div><span></span><a></a>" );
15 ensureJQuery( jQuery );
18 for ( const node of elem ) {
19 result += node.nodeName;
22 assert.strictEqual( result, "DIVSPANA", "for-of works on jQuery objects" );
25 module.exports = { ensureIterability };