web-apps/vendor/requirejs/tests/plugins/pluginMap/pluginMap-tests.js

49 lines
911 B
JavaScript
Raw Normal View History

2016-03-11 00:48:53 +00:00
define('plugin', [], {
load: function (name, req, load, config) {
req([name], function (value) {
load(value);
});
}
});
define('person', [], {
name: 'person'
});
define('employee', ['plugin!person'], function(person) {
return {
name: 'employed ' + person.name
};
});
define('application', ['person'], function(person) {
return {
name: 'application',
person: person
};
});
require({
map: {
'*': {
'person': 'employee'
},
'employee': {
'person': 'person'
}
}
}, ['application'], function (application) {
doh.register(
'pluginMap',
[
function pluginMap(t){
t.is('application', application.name);
t.is('employed person', application.person.name);
}
]
);
doh.run();
});