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

49 lines
911 B
JavaScript

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();
});