forked from js-cookie/js-cookie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register in AMD and UMD if both available
Closes js-cookiegh-257. Closes js-cookiegh-244.
- Loading branch information
1 parent
583c524
commit 92f8e2b
Showing
5 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JavaScript Cookie Test Suite - Environment with AMD and UMD</title> | ||
<link href="../node_modules/qunitjs/qunit/qunit.css" rel="stylesheet"> | ||
<script src="amd-config.js"></script> | ||
<script src="../node_modules/requirejs/require.js"></script> | ||
<script src="environment-with-amd-and-umd.js"></script> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
<div id="qunit-fixture"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require(['qunit'], function (QUnit) { | ||
QUnit.start(); | ||
|
||
QUnit.module('Environment with AMD and UMD', { | ||
beforeEach: function () { | ||
window.exports = {}; | ||
window.module = { | ||
exports: window.exports | ||
}; | ||
}, | ||
afterEach: function () { | ||
delete window.module; | ||
} | ||
}); | ||
|
||
QUnit.test('js-cookie need to register itself in AMD and UMD', function (assert) { | ||
assert.expect(2); | ||
var done = assert.async(); | ||
require(['/src/js.cookie.js'], function () { | ||
var actual = typeof window.module.exports; | ||
var expected = 'function'; | ||
assert.strictEqual(actual, expected, 'should register a function in module.exports'); | ||
assert.notOk(!!window.Cookies, 'should not register globally in AMD/UMD environments'); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |