Skip to content

Even more Web Platform Tests #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 63 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
405e2fa
Bump @types/mocha from 8.0.1 to 8.0.3 (#42)
dependabot[bot] Aug 25, 2020
ecbd115
Bump @open-wc/karma-esm from 3.0.2 to 3.0.4 (#43)
dependabot[bot] Aug 25, 2020
2da7ab2
Bump typescript from 3.9.7 to 4.0.2 (#44)
dependabot[bot] Aug 25, 2020
279149a
Bump pretty-quick from 2.0.1 to 3.0.0 (#45)
dependabot[bot] Aug 25, 2020
a844876
Bump prettier from 2.0.5 to 2.1.1 (#49)
dependabot[bot] Aug 26, 2020
af48988
Bump @open-wc/karma-esm from 3.0.4 to 3.0.5 (#50)
dependabot[bot] Sep 19, 2020
4b7a706
Bump mocha from 8.1.1 to 8.1.3 (#51)
dependabot[bot] Sep 19, 2020
05ac9fa
Bump @babel/preset-env from 7.11.0 to 7.11.5 (#53)
dependabot[bot] Sep 19, 2020
204982e
Bump husky from 4.2.5 to 4.3.0 (#55)
dependabot[bot] Sep 19, 2020
ea9b8ac
Bump karma from 5.1.1 to 5.2.2 (#56)
dependabot[bot] Sep 19, 2020
823575e
Bump pretty-quick from 3.0.0 to 3.0.2 (#58)
dependabot[bot] Sep 19, 2020
0799f3e
Bump node-fetch from 2.6.0 to 2.6.1 (#59)
dependabot[bot] Sep 19, 2020
b201962
Bump prettier from 2.1.1 to 2.1.2 (#60)
dependabot[bot] Sep 19, 2020
26312b1
Handle and return undefined values (#62)
keithamus Sep 21, 2020
8b9f627
Restrict dependabot updates to monthly
Nov 24, 2020
f452cb8
Make all files prettier
Nov 24, 2020
c8cacd4
Bump mocha from 8.1.3 to 8.2.1 (#79)
dependabot[bot] Nov 24, 2020
1a5b96e
Bump @types/mocha from 8.0.3 to 8.0.4 (#80)
dependabot[bot] Nov 24, 2020
f9b589a
Remove PR limit
Nov 24, 2020
d678d07
Auto merge dependabot PRs that pass CI checks
Nov 24, 2020
19c51f2
Squash before auto-merging dependabot PRs
Nov 24, 2020
3c5e6f0
Remove auto-merge action for dependabot PRs
Nov 24, 2020
51a0f95
Bump prettier from 2.1.2 to 2.2.0 (#81)
dependabot[bot] Nov 24, 2020
5c08436
Bump typescript from 4.0.2 to 4.1.2 (#82)
dependabot[bot] Nov 24, 2020
fb276ac
Bump @babel/preset-typescript from 7.10.4 to 7.12.7 (#83)
dependabot[bot] Nov 24, 2020
f3b5d72
Bump @babel/preset-env from 7.11.5 to 7.12.7 (#84)
dependabot[bot] Nov 24, 2020
e5de952
Upgrade to node 14, rework project structure slightly (#85)
Nov 27, 2020
ed001df
Remove unused modules (#86)
koddsson Nov 30, 2020
b815de0
Update packages (#87)
koddsson Nov 30, 2020
4a9655b
Run Web Platform Tests against the polyfill. (#88)
koddsson Nov 30, 2020
29bdcb4
Bump prettier from 2.2.0 to 2.2.1 (#89)
dependabot[bot] Dec 20, 2020
77b501e
Bump @typescript-eslint/eslint-plugin from 4.8.2 to 4.9.0 (#90)
dependabot[bot] Dec 20, 2020
e9c78fb
Bump @typescript-eslint/parser from 4.8.2 to 4.9.0 (#91)
dependabot[bot] Dec 20, 2020
94ef54e
Bump @types/mocha from 8.0.4 to 8.2.0 (#94)
dependabot[bot] Jan 16, 2021
01f14dd
Bump typescript from 4.1.2 to 4.1.3 (#95)
dependabot[bot] Jan 16, 2021
51d49cc
Bump husky from 4.3.0 to 4.3.8 (#97)
dependabot[bot] Jan 16, 2021
42bd665
Bump @typescript-eslint/parser from 4.9.0 to 4.13.0 (#98)
dependabot[bot] Jan 16, 2021
368f4be
Bump @typescript-eslint/eslint-plugin from 4.9.0 to 4.13.0 (#99)
dependabot[bot] Jan 16, 2021
1855c8e
Use GitHub actions for CI (#108)
koddsson Feb 17, 2021
ea6c9dc
Update and rename npm-publish.yml to buld.yml (#110)
koddsson Feb 17, 2021
62ea080
Align with more Web Platform Tests (#107)
koddsson Feb 17, 2021
c08950b
fix typo in workflow name (#112)
keithamus Feb 17, 2021
cc9745b
Limit dependabot to security updates (#113)
markcellus Feb 17, 2021
4b4888d
More tests (#114)
koddsson Feb 17, 2021
e9eff9a
refactor: turn CookieStore into a proper class (#116)
keithamus Feb 18, 2021
c070227
refactor: change CookieSameSite to be an enum (#115)
keithamus Feb 18, 2021
05e9f3c
build: delete travis.yml (#117)
keithamus Feb 18, 2021
2bf4ada
Run tests on foo.bar.localhost hostname (#118)
koddsson Feb 19, 2021
4be5666
Some refactoring (#119)
koddsson Feb 22, 2021
c1da76a
Fix homepage and repository in package.json (#136)
karlhorky May 9, 2021
b65eac0
Delete dependabot.yml (#126)
markcellus May 9, 2021
bf3aeac
Bump glob-parent from 5.1.1 to 5.1.2 (#140)
dependabot[bot] Jul 4, 2021
30605b6
Fix release error due to CommonJS requirement
markcellus Nov 4, 2021
d5d2332
4.0.0-next.0
markcellus Nov 4, 2021
5e27abe
Add more Web Platform Tests (#120)
koddsson Dec 6, 2021
dd64334
Add `cookie_test` function to wpt test harness
koddsson Dec 10, 2021
e08d71c
Add more tests
koddsson Dec 10, 2021
7aa1245
Remove test that is failing
koddsson Dec 10, 2021
a108faa
Add antoher test
koddsson Dec 10, 2021
b9d225a
Delete all cookies before each test
koddsson Dec 10, 2021
a62c5e5
Add more helper functions
koddsson Dec 10, 2021
31b9356
Add more tests
koddsson Dec 10, 2021
ada7873
Add event more tests
koddsson Dec 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .babelrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
coverage
node_modules
13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"root": true,
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"]
}
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci
- run: npm test
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
coverage/
node_modules/
npm-debug.log
index.js
index.tests.js
index.d.ts
index.tests.d.ts
dist/
File renamed without changes.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
package*.json
node_modules
coverage
3 changes: 0 additions & 3 deletions .prettierrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
File renamed without changes.
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/mkay581/cookie-store.svg?branch=master)](https://travis-ci.org/mkay581/cookie-store)
[![npm version](https://badge.fury.io/js/cookie-store.svg)](https://www.npmjs.com/package/cookie-store)

A polyfill to allow use of the [Cookie Store API](https://wicg.github.io/cookie-store/) in modern browsers that don't support it natively, including IE11. Also compatible with TypeScript.
A ponyfill to allow use of the [Cookie Store API](https://wicg.github.io/cookie-store/) in modern browsers that don't support it natively, including IE11. Also compatible with TypeScript.

## Installation

Expand All @@ -15,7 +15,7 @@ npm install cookie-store

```js
// import polyfill and declare types
import 'cookie-store';
import {cookieStore} from 'cookie-store';

// set a cookie
await cookieStore.set('forgive', 'me');
Expand Down
160 changes: 160 additions & 0 deletions change_eventhandler_for_document_cookie.https.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
// META: title=Cookie Store API: Observing 'change' events in document when cookies set via document.cookie
// META: script=resources/cookie-test-helpers.js

'use strict';

cookie_test(async t => {
let eventPromise = observeNextCookieChangeEvent();
await setCookieStringDocument('DOCUMENT-cookie=value; path=/');
assert_equals(
await getCookieString(),
'DOCUMENT-cookie=value',
'Cookie we wrote using document.cookie in cookie jar');
assert_equals(
await getCookieStringHttp(),
'DOCUMENT-cookie=value',
'Cookie we wrote using document.cookie in HTTP cookie jar');
assert_equals(
await getCookieStringDocument(),
'DOCUMENT-cookie=value',
'Cookie we wrote using document.cookie in document.cookie');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'value'}]},
'Cookie we wrote using document.cookie is observed');

eventPromise = observeNextCookieChangeEvent();
await setCookieStringDocument('DOCUMENT-cookie=new-value; path=/');
assert_equals(
await getCookieString(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using document.cookie in cookie jar');
assert_equals(
await getCookieStringHttp(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using document.cookie in HTTP cookie jar');
assert_equals(
await getCookieStringDocument(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using document.cookie in document.cookie');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'new-value'}]},
'Cookie we overwrote using document.cookie is observed');

eventPromise = observeNextCookieChangeEvent();
await setCookieStringDocument('DOCUMENT-cookie=DELETED; path=/; max-age=0');
assert_equals(
await getCookieString(),
undefined,
'Empty cookie jar after document.cookie' +
' cookie-clearing using max-age=0');
assert_equals(
await getCookieStringHttp(),
undefined,
'Empty HTTP cookie jar after document.cookie' +
' cookie-clearing using max-age=0');
assert_equals(
await getCookieStringDocument(),
undefined,
'Empty document.cookie cookie jar after document.cookie' +
' cookie-clearing using max-age=0');
await verifyCookieChangeEvent(
eventPromise, {deleted: [{name: 'DOCUMENT-cookie'}]},
'Deletion observed after document.cookie cookie-clearing' +
' using max-age=0');
}, 'document.cookie set/overwrite/delete observed by CookieStore');

cookie_test(async t => {
let eventPromise = observeNextCookieChangeEvent();
await cookieStore.set('DOCUMENT-cookie', 'value');
assert_equals(
await getCookieString(),
'DOCUMENT-cookie=value',
'Cookie we wrote using CookieStore in cookie jar');
assert_equals(
await getCookieStringHttp(),
'DOCUMENT-cookie=value',
'Cookie we wrote using CookieStore in HTTP cookie jar');
assert_equals(
await getCookieStringDocument(),
'DOCUMENT-cookie=value',
'Cookie we wrote using CookieStore in document.cookie');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'value'}]},
'Cookie we wrote using CookieStore is observed');

eventPromise = observeNextCookieChangeEvent();
await cookieStore.set('DOCUMENT-cookie', 'new-value');
assert_equals(
await getCookieString(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using CookieStore in cookie jar');
assert_equals(
await getCookieStringHttp(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using CookieStore in HTTP cookie jar');
assert_equals(
await getCookieStringDocument(),
'DOCUMENT-cookie=new-value',
'Cookie we overwrote using CookieStore in document.cookie');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: 'DOCUMENT-cookie', value: 'new-value'}]},
'Cookie we overwrote using CookieStore is observed');

eventPromise = observeNextCookieChangeEvent();
await cookieStore.delete('DOCUMENT-cookie');
assert_equals(
await getCookieString(),
undefined,
'Empty cookie jar after CookieStore delete');
assert_equals(
await getCookieStringHttp(),
undefined,
'Empty HTTP cookie jar after CookieStore delete');
assert_equals(
await getCookieStringDocument(),
undefined,
'Empty document.cookie cookie jar after CookieStore delete');
await verifyCookieChangeEvent(
eventPromise, {deleted: [{name: 'DOCUMENT-cookie'}]},
'Deletion observed after CookieStore delete');
}, 'CookieStore set/overwrite/delete observed by document.cookie');


cookie_test(async t => {
let eventPromise = observeNextCookieChangeEvent();
await setCookieStringDocument('DOCUMENT-🍪=🔵; path=/');
assert_equals(
await getCookieString(),
'DOCUMENT-🍪=🔵',
'Cookie we wrote using document.cookie in cookie jar');
await verifyCookieChangeEvent(
eventPromise, {changed: [{name: 'DOCUMENT-🍪', value: '🔵'}]},
'Cookie we wrote using document.cookie is observed');

eventPromise = observeNextCookieChangeEvent();
await setCookieStringDocument('DOCUMENT-🍪=DELETED; path=/; max-age=0');
assert_equals(
await getCookieString(),
undefined,
'Empty cookie jar after document.cookie' +
' cookie-clearing using max-age=0');
await verifyCookieChangeEvent(
eventPromise, {deleted: [{name: 'DOCUMENT-🍪'}]},
'Deletion observed after document.cookie cookie-clearing' +
' using max-age=0');
}, 'CookieStore agrees with document.cookie on encoding non-ASCII cookies');


cookie_test(async t => {
await cookieStore.set('DOCUMENT-🍪', '🔵');
assert_equals(
await getCookieStringDocument(),
'DOCUMENT-🍪=🔵',
'Cookie we wrote using CookieStore in document.cookie');

await cookieStore.delete('DOCUMENT-🍪');
assert_equals(
await getCookieStringDocument(),
undefined,
'Empty cookie jar after CookieStore delete');
}, 'document.cookie agrees with CookieStore on encoding non-ASCII cookies');
Loading