Content/jqueryui/tests/unit/core/selector.js

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
 * selector unit tests
 */
(function($) {

module("core - selectors");

function isFocusable(selector, msg) {
	QUnit.push($(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is focusable");
}

function isNotFocusable(selector, msg) {
	QUnit.push($(selector).length && !$(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is not focusable");
}

function isTabbable(selector, msg) {
	QUnit.push($(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is tabbable");
}

function isNotTabbable(selector, msg) {
	QUnit.push($(selector).length && !$(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is not tabbable");
}

test("data", function() {
	expect(15);

	var el;
	function shouldHaveData(msg) {
		ok(el.is(":data(test)"), msg);
	}
	function shouldNotHaveData(msg) {
		ok(!el.is(":data(test)"), msg);
	}

	el = $("<div>");
	shouldNotHaveData("data never set");

	el = $("<div>").data("test", null);
	shouldNotHaveData("data is null");

	el = $("<div>").data("test", true);
	shouldHaveData("data set to true");

	el = $("<div>").data("test", false);
	shouldNotHaveData("data set to false");

	el = $("<div>").data("test", 0);
	shouldNotHaveData("data set to 0");

	el = $("<div>").data("test", 1);
	shouldHaveData("data set to 1");

	el = $("<div>").data("test", "");
	shouldNotHaveData("data set to empty string");

	el = $("<div>").data("test", "foo");
	shouldHaveData("data set to string");

	el = $("<div>").data("test", []);
	shouldHaveData("data set to empty array");
后面还有 191 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。