aboutsummaryrefslogtreecommitdiffstats
path: root/test/node_smoke_tests/module/lib/ensure_iterability_es6.js
blob: c12e58c59f7d7ee38eac06d43d4bd2c3e9268ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import assert from "node:assert/strict";
const { JSDOM } = await import( "jsdom" );

const { ensureJQuery } = await import( "./ensure_jquery.js" );

export const ensureIterability = async( jQueryModuleSpecifier ) => {
	const { window } = new JSDOM( "" );

	const { jQueryFactory } = await import( jQueryModuleSpecifier );
	const jQuery = jQueryFactory( window );
	const elem = jQuery( "<div></div><span></span><a></a>" );

	ensureJQuery( jQuery );

	let result = "";
	for ( const node of elem ) {
		result += node.nodeName;
	}

	assert.strictEqual( result, "DIVSPANA", "for-of works on jQuery objects" );
};