How to use the cookie/1.1/cookie.set function in cookie

To help you get started, we’ve selected a few cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heeroluo / jraiser / dev-server / src / unit-test / cookie / 1.1 / main.js View on Github external
QUnit.test('set', function(assert) {
	var done = assert.async();

	cookie.set('case2-key', 'case2-value');
	assert.strictEqual(cookie.get('case2-key'), 'case2-value');

	cookie.set('case3-key', 'case3-value', { expires: 1000 });
	assert.strictEqual(cookie.get('case3-key'), 'case3-value', '未过期');
	setTimeout(function() {
		assert.equal(cookie.get('case3-key'), null, '已过期');
		done();
	}, 1200);
});
github heeroluo / jraiser / dev-server / src / unit-test / cookie / 1.1 / main.js View on Github external
QUnit.test('set', function(assert) {
	var done = assert.async();

	cookie.set('case2-key', 'case2-value');
	assert.strictEqual(cookie.get('case2-key'), 'case2-value');

	cookie.set('case3-key', 'case3-value', { expires: 1000 });
	assert.strictEqual(cookie.get('case3-key'), 'case3-value', '未过期');
	setTimeout(function() {
		assert.equal(cookie.get('case3-key'), null, '已过期');
		done();
	}, 1200);
});
github heeroluo / jraiser / dev-server / src / unit-test / cookie / 1.1 / main.js View on Github external
QUnit.test('remove', function(assert) {
	cookie.set('case4-key', 'case4-value');
	cookie.remove('case4-key');
	assert.strictEqual([null, ''].indexOf(cookie.get('case4-key')) !== -1, true);
});