mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Per the spec in modules.md the exports property should default to an empty object. We lazy allocate it so that modules that just replace it don't create the empty object and then throw it away. R=abarth@chromium.org Review URL: https://codereview.chromium.org/872043003
26 lines
879 B
Plaintext
26 lines
879 B
Plaintext
<html>
|
|
<import src="../resources/chai.sky" />
|
|
<import src="../resources/mocha.sky" />
|
|
<script>
|
|
describe('Module', function() {
|
|
it('should be constructable', function() {
|
|
var doc1 = new Document();
|
|
var app = new Application(doc1, "http://www.example.com/app");
|
|
|
|
var doc2 = new Document();
|
|
var module = new Module(app, doc2, "http://www.example.com/module");
|
|
assert.equal(module.application, app);
|
|
assert.equal(module.document, doc2);
|
|
assert.equal(module.url, "http://www.example.com/module");
|
|
});
|
|
|
|
it('should have an empty object by default for exports', function() {
|
|
var app = new Application(new Document(), "http://www.example.com/app");
|
|
var module = new Module(app, new Document(), "http://www.example.com/module");
|
|
assert.isObject(module.exports);
|
|
assert.lengthOf(Object.keys(module.exports), 0);
|
|
});
|
|
});
|
|
</script>
|
|
</html>
|