Skip to content

Commit 50f54d5

Browse files
Bump to @guardian/cql 1.3.5 to ensure content pasted into chip values is correctly quoted
1 parent af42eee commit 50f54d5

4 files changed

Lines changed: 27 additions & 6 deletions

File tree

kahuna/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kahuna/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
33
"@babel/polyfill": "^7.8.7",
4-
"@guardian/cql": "^1.3.4",
4+
"@guardian/cql": "^1.3.5",
55
"@guardian/user-telemetry-client": "^1.1.0",
66
"@sentry/browser": "^6.10.0",
77
"@sentry/integrations": "^6.10.0",
@@ -75,7 +75,7 @@
7575
"webpack-merge": "^5.8.0"
7676
},
7777
"scripts": {
78-
"test": "npm run lint && jest --coverage",
78+
"test": "jest --coverage",
7979
"lint": "eslint public/js && htmllint public/js/**/*.html",
8080
"lint-fix": "eslint public/js --fix && htmllint public/js/**/*.html",
8181
"dist": "webpack --config webpack.config.prod.js",

kahuna/public/js/components/gr-cql-input/syntax.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ const queries = [
1010
cql: "text",
1111
structuredQuery: [{ type: "text", value: "text" }]
1212
},
13+
{
14+
name: "an empty chip",
15+
cql: "+:",
16+
structuredQuery: []
17+
},
1318
{
1419
name: "a single chip",
1520
cql: "has:chip",
@@ -87,6 +92,18 @@ const queries = [
8792
},
8893
{ type: "text", value: "more text" }
8994
]
95+
},
96+
{
97+
name: "chips with quoted keys",
98+
cql: `category:"PR Image"`,
99+
structuredQuery: [
100+
{
101+
filterType: "inclusion",
102+
key: "category",
103+
type: "filter",
104+
value: "PR Image"
105+
}
106+
]
90107
}
91108
];
92109

kahuna/public/js/components/gr-cql-input/syntax.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const structuredQueryFromField = ({
5353
key: { literal, tokenType },
5454
value
5555
}: CqlField): StructuredQuery => {
56+
if (!literal) {
57+
return [];
58+
}
59+
5660
const type = literal === "collection" ? "static-filter" : "filter";
5761
const filterType =
5862
tokenType === "CHIP_KEY_NEGATIVE" ? "exclusion" : "inclusion";

0 commit comments

Comments
 (0)