Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: sky/tests/lowlevel/classlist.sky

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tests/lowlevel/camel-case-expected.txt ('k') | sky/tests/lowlevel/classlist-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/lowlevel/classlist.sky
diff --git a/sky/tests/lowlevel/classlist.sky b/sky/tests/lowlevel/classlist.sky
index 853a817823e05b44ee866587efa5eee04cf4bbce..98fe3a5c053089e59303613c4388ecebe90f5af7 100644
--- a/sky/tests/lowlevel/classlist.sky
+++ b/sky/tests/lowlevel/classlist.sky
@@ -1,7 +1,5 @@
<!DOCTYPE html>
<sky>
-<import src="../resources/mocha.sky" />
-<import src="../resources/chai.sky" />
<style>
div { font-size: 5px; }
.font-10 { font-size: 10px; }
@@ -10,101 +8,119 @@
</style>
<div id="sandbox"></div>
<script>
-describe("Class list", function() {
+import "../resources/third_party/unittest/unittest.dart";
+import "../resources/unit.dart";
+
+import "dart:sky";
+
+main() {
+ initUnit();
+
var sandbox = document.getElementById("sandbox");
- var target;
+ var target = null;
- beforeEach(function() {
+ setUp(() {
target = document.createElement("div");
sandbox.appendChild(target);
});
- afterEach(function() {
+ tearDown(() {
target.remove();
});
- it("should add multiple classes", function() {
- target.classList.add("first", "second", "third");
- assert.equal(target.classList.toString(), "first second third");
- });
+ // test("should add multiple classes", () {
+ // target.classList..add("first", "second", "third");
+ // expect(target.classList.toString(), equals("first second third"));
+ // });
- it("should add classes in order", function() {
- target.classList.add("first");
- target.classList.add("second");
- assert.equal(target.classList.toString(), "first second");
+ test("should add classes in order", () {
+ target.classList..add("first")
+ ..add("second");
+ expect(target.classList.toString(), equals("first second"));
});
- it("should remove classes", function() {
- target.classList.add("first");
- target.classList.add("second");
- target.classList.add("third");
- target.classList.remove("second");
- assert.equal(target.classList.toString(), "first third");
+ test("should remove classes", () {
+ target.classList..add("first")
+ ..add("second")
+ ..add("third")
+ ..remove("second");
+ expect(target.classList.toString(), equals("first third"));
});
- it("should remove multiple classes", function() {
- target.classList.add("first", "second", "third");
- target.classList.remove("first", "third");
- assert.equal(target.classList.toString(), "second");
- });
+ // test("should remove multiple classes", () {
+ // target.classList.add("first", "second", "third");
+ // target.classList.remove("first", "third");
+ // expect(target.classList.toString(), equals("second"));
+ // });
- it("should clear all classes", function() {
+ test("should clear all classes", () {
target.classList.add("first");
target.classList.add("second");
target.classList.clear();
- assert.equal(target.classList.toString(), "");
- assert.isFalse(target.hasAttribute("class"));
+ expect(target.classList.toString(), equals(""));
+ expect(target.hasAttribute("class"), isFalse);
});
- it("should check for classes", function() {
- target.classList.add("first", "second", "third");
- assert.isTrue(target.classList.contains("first"));
- assert.isTrue(target.classList.contains("second"));
- assert.isTrue(target.classList.contains("third"));
+ test("should check for classes", () {
+ target.classList..add("first")
+ ..add("second")
+ ..add("third");
+ expect(target.classList.contains("first"), isTrue);
+ expect(target.classList.contains("second"), isTrue);
+ expect(target.classList.contains("third"), isTrue);
target.classList.remove("second");
- assert.isTrue(target.classList.contains("first"));
- assert.isFalse(target.classList.contains("second"));
- assert.isTrue(target.classList.contains("third"));
+ expect(target.classList.contains("first"), isTrue);
+ expect(target.classList.contains("second"), isFalse);
+ expect(target.classList.contains("third"), isTrue);
});
- it("should get classes by index", function() {
- target.classList.add("first", "second", "third");
- assert.equal(target.classList[0], "first");
- assert.equal(target.classList[1], "second");
- assert.equal(target.classList[2], "third");
- assert.equal(target.classList.item(0), "first");
- assert.equal(target.classList.item(1), "second");
- assert.equal(target.classList.item(2), "third");
+ test("should get classes by index", () {
+ target.classList..add("first")
+ ..add("second")
+ ..add("third");
+ // expect(target.classList[0], equals("first"));
+ // expect(target.classList[1], equals("second"));
+ // expect(target.classList[2], equals("third"));
+ expect(target.classList.item(0), equals("first"));
+ expect(target.classList.item(1), equals("second"));
+ expect(target.classList.item(2), equals("third"));
});
- it("should toggle classes", function() {
- target.classList.add("first", "second");
- assert.isFalse(target.classList.toggle("first"));
- assert.equal(target.classList.toString(), "second");
- assert.isTrue(target.classList.toggle("first"));
- assert.equal(target.classList.toString(), "second first");
- assert.isTrue(target.classList.toggle("second", true));
- assert.equal(target.classList.toString(), "second first");
- assert.isTrue(target.classList.toggle("second", true));
- assert.isFalse(target.classList.toggle("second", false));
- assert.isFalse(target.classList.toggle("second", false));
- assert.equal(target.classList.toString(), "first");
+ test("should toggle classes", () {
+ target.classList..add("first")
+ ..add("second");
+ expect(target.classList.toggle("first"), isFalse);
+ expect(target.classList.toString(), equals("second"));
+ expect(target.classList.toggle("first"), isTrue);
+ expect(target.classList.toString(), equals("second first"));
+ // expect(target.classList.toggle("second", true), isTrue);
+ // expect(target.classList.toString(), equals("second first"));
+ // expect(target.classList.toggle("second", true), isTrue);
+ // expect(target.classList.toggle("second", false), isFalse);
+ // expect(target.classList.toggle("second", false), isFalse);
+ // expect(target.classList.toString(), equals("first"));
});
- it("should dynamically update style", function() {
- assert.equal(getComputedStyle(target).fontSize, "5px");
+ test("should dynamically update style", () {
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("5px"));
target.classList.add("font-10");
target.classList.add("font-12");
- assert.equal(getComputedStyle(target).fontSize, "12px");
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("12px"));
target.classList.add("font-24");
- assert.equal(getComputedStyle(target).fontSize, "24px");
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("24px"));
target.classList.remove("font-12");
- assert.equal(getComputedStyle(target).fontSize, "24px");
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("24px"));
target.classList.remove("font-24");
- assert.equal(getComputedStyle(target).fontSize, "10px");
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("10px"));
target.classList.remove("font-10");
- assert.equal(getComputedStyle(target).fontSize, "5px");
+ expect(window.getComputedStyle(target).getPropertyValue("font-size"),
+ equals("5px"));
});
-});
+}
</script>
</sky>
« no previous file with comments | « sky/tests/lowlevel/camel-case-expected.txt ('k') | sky/tests/lowlevel/classlist-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698