From a971f2dda750a24019f3b187603caa609148702c Mon Sep 17 00:00:00 2001
From: jrburke
Date: Sat, 9 Jul 2016 14:45:37 +0800
Subject: [PATCH] Start of test
---
tests/all.js | 2 +
tests/mapConfig/topLevel/a.js | 6 +++
.../topLevel/mapConfigTopLevel-tests.js | 54 +++++++++++++++++++
.../mapConfig/topLevel/mapConfigTopLevel.html | 18 +++++++
tests/mapConfig/topLevel/modules/b.js | 3 ++
tests/mapConfig/topLevel/modules/e.js | 3 ++
tests/mapConfig/topLevel/util/func.js | 6 +++
tests/mapConfig/topLevel/vendor/c.js | 3 ++
tests/mapConfig/topLevel/vendor/nested/d.js | 3 ++
9 files changed, 98 insertions(+)
create mode 100644 tests/mapConfig/topLevel/a.js
create mode 100644 tests/mapConfig/topLevel/mapConfigTopLevel-tests.js
create mode 100644 tests/mapConfig/topLevel/mapConfigTopLevel.html
create mode 100644 tests/mapConfig/topLevel/modules/b.js
create mode 100644 tests/mapConfig/topLevel/modules/e.js
create mode 100644 tests/mapConfig/topLevel/util/func.js
create mode 100644 tests/mapConfig/topLevel/vendor/c.js
create mode 100644 tests/mapConfig/topLevel/vendor/nested/d.js
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 @@
+
+
+
+ require.js: Map Config Top Level Test
+
+
+
+
+
+
+ require.js: Map Config Top Level Test
+ 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'
+});
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
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:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy