web-apps/vendor/requirejs/tests/depoverlap.js
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

36 lines
1.2 KiB
JavaScript

require(["require", "uno"],
function (require, uno) {
doh.register(
"depoverlap",
[
function depoverlap(t){
//First confirm there is only one script tag for each
//module:
var scripts = document.getElementsByTagName("script"),
i, counts = {}, modName, props, something;
for (var i = scripts.length - 1; i > -1; i--) {
modName = scripts[i].getAttribute("data-requiremodule");
if (modName) {
if (!(modName in counts)) {
counts[modName] = 0;
}
counts[modName] += 1;
}
}
//Now that we counted all the modules make sure count
//is always one.
for (prop in counts) {
t.is(1, counts[prop]);
}
t.is("uno", uno.name);
something = uno.doSomething();
t.is("dos", something.dosName);
t.is("tres", something.tresName);
}
]
);
doh.run();
});