diff --git a/tests/all.js b/tests/all.js index 17f32714e..60d7f50c5 100644 --- a/tests/all.js +++ b/tests/all.js @@ -114,6 +114,8 @@ doh.registerUrl("mapConfigRelative", "../mapConfig/mapConfigRelative.html"); doh.registerUrl("mapConfigSpecificity", "../mapConfig/mapConfigSpecificity.html"); doh.registerUrl("mapConfigPlugin", "../mapConfig/mapConfigPlugin.html"); doh.registerUrl("mapConfigPluginBuilt", "../mapConfig/built/mapConfigPluginBuilt.html"); +doh.registerUrl("mapConfigTopLevel", "../mapConfig/topLevel/mapConfigTopLevel.html"); + doh.registerUrl("secondLateConfigPlugin", "../secondLateConfigPlugin/secondLateConfigPlugin.html"); doh.registerUrl("layers", "../layers/layers.html", 10000); diff --git a/tests/mapConfig/topLevel/a.js b/tests/mapConfig/topLevel/a.js new file mode 100644 index 000000000..545ea09fb --- /dev/null +++ b/tests/mapConfig/topLevel/a.js @@ -0,0 +1,6 @@ +define(['b', 'c/sub/level/vendor/c'], function (b, c) { + return { + b: b, + c: c + }; +}); diff --git a/tests/mapConfig/topLevel/mapConfigTopLevel-tests.js b/tests/mapConfig/topLevel/mapConfigTopLevel-tests.js new file mode 100644 index 000000000..ad222b137 --- /dev/null +++ b/tests/mapConfig/topLevel/mapConfigTopLevel-tests.js @@ -0,0 +1,54 @@ +/*global doh */ +require({ + baseUrl: './', + map: { + '*': { + //Remove 'sub/level' from + //any module ID, so that the + //rest of the modules ID is + //treated as top level. + 'sub/level': '', + + //This means, "prefix with modules/ unless + //there is a more specific map config at + //this level". + '' : 'modules' + }, + 'util': { + //If util asks for any modules, + //add a 'vendor/' prefix to the + //top level part. + '' : 'vendor' + }, + + //This is not supported. This could be + //considered like '*' but it looks weird + //at the top level of this config, and '*' + //is existing API. Using '*' for the other + //areas where '' is used would be confusing, + //does not read as clear as '' does. It + //would read as a "all" selector vs a + //module ID truncattion/replace string. + '' : { + 'vendor': 'doesnotexist' + } + } + }, + ['util/func', 'sub/level/a', 'e'], + function(utilFunc, a) { + 'use strict'; + doh.register( + 'mapConfigTopLevel', + [ + function mapConfigTopLevel(t){ + t.is('e', e.name); + t.is('d', e.d.name); + t.is(true, e.d.adapted); + t.is(true, a.adapted); + t.is('d', a.name); + } + ] + ); + doh.run(); + } +); diff --git a/tests/mapConfig/topLevel/mapConfigTopLevel.html b/tests/mapConfig/topLevel/mapConfigTopLevel.html new file mode 100644 index 000000000..32f526afc --- /dev/null +++ b/tests/mapConfig/topLevel/mapConfigTopLevel.html @@ -0,0 +1,18 @@ + + +
+Test using '' in the map config, for indicating a top level module ID + mapping.
+ #1552 + +Check console for messages
+ + diff --git a/tests/mapConfig/topLevel/modules/b.js b/tests/mapConfig/topLevel/modules/b.js new file mode 100644 index 000000000..6a0edcdb1 --- /dev/null +++ b/tests/mapConfig/topLevel/modules/b.js @@ -0,0 +1,3 @@ +define({ + name: 'b' +}); diff --git a/tests/mapConfig/topLevel/modules/e.js b/tests/mapConfig/topLevel/modules/e.js new file mode 100644 index 000000000..d990dc5e5 --- /dev/null +++ b/tests/mapConfig/topLevel/modules/e.js @@ -0,0 +1,3 @@ +define({ + name: 'e' +}); diff --git a/tests/mapConfig/topLevel/util/func.js b/tests/mapConfig/topLevel/util/func.js new file mode 100644 index 000000000..023a8e510 --- /dev/null +++ b/tests/mapConfig/topLevel/util/func.js @@ -0,0 +1,6 @@ +define(['nested/d'], function(d) { + return { + name: 'util/func', + d: d + }; +}); diff --git a/tests/mapConfig/topLevel/vendor/c.js b/tests/mapConfig/topLevel/vendor/c.js new file mode 100644 index 000000000..f01a0f832 --- /dev/null +++ b/tests/mapConfig/topLevel/vendor/c.js @@ -0,0 +1,3 @@ +define({ + name: 'c' +}); diff --git a/tests/mapConfig/topLevel/vendor/nested/d.js b/tests/mapConfig/topLevel/vendor/nested/d.js new file mode 100644 index 000000000..0612045f8 --- /dev/null +++ b/tests/mapConfig/topLevel/vendor/nested/d.js @@ -0,0 +1,3 @@ +define({ + name: 'd' +});Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: