Skip to content

Commit 5b958da

Browse files
committed
Add tests for rtl css
1 parent 8ecfa25 commit 5b958da

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/rtlTest.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*globals describe */
2+
3+
var test = require("./helpers").test;
4+
var testMinimize = require("./helpers").testMinimize;
5+
6+
describe("rtlcss", function() {
7+
var _document
8+
before(() => {
9+
_document = global.document
10+
global.document = {
11+
getElementsByTagName: function() {
12+
return [{
13+
getAttribute: function() {
14+
return 'rtl'
15+
}
16+
}];
17+
}
18+
};
19+
})
20+
21+
after(() => {
22+
global.document = _document
23+
})
24+
25+
test("basic property", ".class { right: 10px; }", [
26+
[1, ".class { left: 10px; }", ""]
27+
]);
28+
test("multiple properties", ".class { border-left: 10px; padding-right: 5px; background: red; }", [
29+
[1, ".class { border-right: 10px; padding-left: 5px; background: red; }", ""]
30+
]);
31+
test("ignore", ".class { /*rtl:begin:ignore*/border-right: 10px;/*rtl:end:ignore*/ left: 10px; }", [
32+
[1, ".class {border-right: 10px; right: 10px; }", ""]
33+
])
34+
});

0 commit comments

Comments
 (0)