Skip to content

Commit 6ffc0b4

Browse files
Test the behavior for undefined value in custom attributes
Closes js-cookiegh-59.
1 parent e36ddd2 commit 6ffc0b4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/tests.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,22 @@ QUnit.test('false secure value', function (assert) {
192192
assert.strictEqual(actual, expected, 'false should not modify path in cookie string');
193193
});
194194

195+
QUnit.test('undefined attribute value', function (assert) {
196+
assert.expect(4);
197+
assert.strictEqual(Cookies.set('c', 'v', {
198+
expires: undefined
199+
}), 'c=v; path=/', 'should not write undefined expires attribute');
200+
assert.strictEqual(Cookies.set('c', 'v', {
201+
path: undefined
202+
}), 'c=v', 'should not write undefined path attribute');
203+
assert.strictEqual(Cookies.set('c', 'v', {
204+
domain: undefined
205+
}), 'c=v; path=/', 'should not write undefined domain attribute');
206+
assert.strictEqual(Cookies.set('c', 'v', {
207+
secure: undefined
208+
}), 'c=v; path=/', 'should not write undefined secure attribute');
209+
});
210+
195211
QUnit.module('remove', lifecycle);
196212

197213
QUnit.test('deletion', function (assert) {

0 commit comments

Comments
 (0)