// some work on style sheets

This commit is contained in:
Kevin Granger
2013-07-18 18:51:24 +02:00
parent 02921dc9d0
commit 0b4512dbcb
1654 changed files with 171753 additions and 294 deletions
@@ -0,0 +1,3 @@
var one = {
name: "one"
};
@@ -0,0 +1,10 @@
define("three", {
name: "three"
});
define("four", ["three"], function (three) {
return {
name: "four",
threeName: "three"
};
});
@@ -0,0 +1,10 @@
define("one", {
name: "one"
});
define("two", ["one"], function (one) {
return {
name: "two",
oneName: "one"
};
});
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: urlFetch Mapping Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
require({
baseUrl: "./",
paths: {
'one' : 'two',
'two' : 'two',
'three': 'three',
'four': 'three'
}
},
["require", "one", "two", "three", "four"],
function(require, one, two, three, four) {
doh.register(
"urlfetch",
[
function urlfetch(t){
//First confirm there is only one script tag for each
//module:
var scripts = document.getElementsByTagName("script"),
i, counts = {}, url, props, something;
for (var i = scripts.length - 1; i > -1; i--) {
url = scripts[i].href;
if (url) {
if (!(url in counts)) {
counts[url] = 0;
}
counts[url] += 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("one", one.name);
t.is("one", two.oneName);
t.is("two", two.name);
t.is("three", three.name);
t.is("three", four.threeName);
t.is("four", four.name);
}
]
);
doh.run();
}
);
</script>
</head>
<body>
<h1>require.js: urlFetch Mapping Test</h1>
<p>Make sure that multiple modules mapped to the same URL only get
the URL fetched once.</p>
<p>Check console for messages</p>
</body>
</html>