{"size": 1705, "ext": "js", "max_stars_repo_path": "test/unit/FakeDomTokenList.test.js", "max_stars_repo_name": "jespertheend/fake-dom", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/unit/FakeDomTokenList.test.js", "max_issues_repo_name": "jespertheend/fake-dom", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/unit/FakeDomTokenList.test.js", "max_forks_repo_name": "jespertheend/fake-dom", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.1573033708, "max_line_length": 65, "alphanum_fraction": 0.5841642229}
import { assertEquals } from "asserts";
import { FakeDomTokenList } from "../../src/FakeDomTokenList.js";

Deno.test({
	name: "length",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		assertEquals(list.length, 3);
	},
});

Deno.test({
	name: "value",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		assertEquals(list.value, "a b c");
	},
});

Deno.test({
	name: "toggle()",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		list.toggle("b");
		assertEquals(list.value, "a c");
	},
});

Deno.test({
	name: "toggle() true when doesn't exist yet",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "c");
		list.toggle("b", true);
		assertEquals(list.value, "a c b");
	},
});

Deno.test({
	name: "toggle() true when it already exists",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		list.toggle("b", true);
		assertEquals(list.value, "a b c");
	},
});

Deno.test({
	name: "toggle() false when it already doesn't exists",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "c");
		list.toggle("b", false);
		assertEquals(list.value, "a c");
	},
});

Deno.test({
	name: "toggle() false when it exists",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		list.toggle("b", false);
		assertEquals(list.value, "a c");
	},
});

Deno.test({
	name: "contains() true",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		assertEquals(list.contains("b"), true);
	},
});

Deno.test({
	name: "contains() false",
	fn() {
		const list = new FakeDomTokenList();
		list.add("a", "b", "c");
		assertEquals(list.contains("d"), false);
	},
});
