File: test.load-css.js

package info (click to toggle)
node-headjs 1.0.3%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,884 kB
  • sloc: xml: 33; sh: 14; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module("Load");

// only sync tests use expect()
// http://qunitjs.com/cookbook/#synchronous-callbacks

function getStyle(ele, styleProp) {
    var y = "";

    if (ele.currentStyle) {
        y = ele.currentStyle[styleProp];
    }
    else if (window.getComputedStyle) {
        y = document.defaultView.getComputedStyle(ele, null).getPropertyValue(styleProp);
    }
    
    return y;
}

// INFO: will make had fail (and nothing else continues!) if file not exists
asyncTest("ready(cssFileName).load(cssFilePath)", 1, function () {
    head.ready("test.css", function () {
        var result = getStyle(document.getElementById("browserscope"), "display");
        ok(result === "block", "Ready: test.css");

        start();
    })

    .load("assets/test.css");
});