Skip to content

Commit

Permalink
adds rtl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Mar 7, 2023
1 parent b91b947 commit 39e124e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/rtl-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import assert from "assert";
import {default as rtl} from "../src/rtl.js";
import it from "./jsdom.js";

it("rtl", () => {
assert.strictEqual(false, rtl(), "default ltr");
});

it("rtl - html", "<!doctype html><html dir='rtl'><head><meta charset='utf-8'></head><body></body></html>", () => {
assert.strictEqual(true, rtl(), "detect HTML attribute");
});

it("rtl - body", "<!doctype html><html><head><meta charset='utf-8'></head><body dir='rtl'></body></html>", () => {
assert.strictEqual(true, rtl(), "detect BODY attribute");
});

it("rtl - nested", "<!doctype html><html><head><meta charset='utf-8'></head><body><main dir='rtl'><svg id='test'></svg></main></body></html>", () => {
assert.strictEqual(true, rtl(document.querySelector("#test")), "detect nested inheritance");
});

0 comments on commit 39e124e

Please sign in to comment.