1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 05:30:01 +00:00

Remove implied order by name

This commit is contained in:
Matt Gibson
2025-03-18 13:02:51 -07:00
parent 1c396da40f
commit 2528efd8b9
3 changed files with 15 additions and 21 deletions

View File

@@ -72,8 +72,6 @@ TERM ->
| %func_website %string {% function(d) { const start = d[0].offset; const end = d[1].offset + d[1].value.length; return { type: 'website', website: d[1].value, start, end, length: end - start + 1 } } %}
# only items with a specified website and a given match pattern
| %func_website %string %access %string {% function(d) { const start = d[0].offset; const end = d[3].offset + d[3].value.length; return { type: 'websiteMatch', website: d[1].value, matchType: d[3].value, start, end, length: end - start + 1 } } %}
# order by name
| %func_order %param_dir {% function(d) { const start = d[0].offset; const end = d[1].offset + d[1].value.length; return { type: 'orderBy', field: 'name', direction: d[1].value, start, end, length: end - start + 1 } } %}
# order by a specified field
| %func_order %string %param_dir {% function(d) { const start = d[0].offset; const end = d[2].offset + d[2].value.length; return { type: 'orderBy', field: d[1].value, direction: d[2].value, start, end, length: end - start + 1 } } %}
# Boolean NOT operator

View File

@@ -323,6 +323,20 @@ const PartialQuoteEnd = {
],
};
const OrderBy = {
query: "order:name:asc",
expectedResults: [
{
contents: {
type: "orderBy",
field: "name",
direction: "asc",
},
type: "search",
},
],
};
const EmptyParens = "()";
describe("search query grammar", () => {
@@ -352,6 +366,7 @@ describe("search query grammar", () => {
FunctionNot,
PartialQuoteBegin,
PartialQuoteEnd,
OrderBy,
])("$query", ({ query, expectedResults }) => {
parser.feed(query);
expect(parser.results.length).toEqual(expectedResults.length);

View File

@@ -338,25 +338,6 @@ const grammar: Grammar = {
};
},
},
{
name: "TERM",
symbols: [
lexer.has("func_order") ? { type: "func_order" } : func_order,
lexer.has("param_dir") ? { type: "param_dir" } : param_dir,
],
postprocess: function (d) {
const start = d[0].offset;
const end = d[1].offset + d[1].value.length;
return {
type: "orderBy",
field: "name",
direction: d[1].value,
start,
end,
length: end - start + 1,
};
},
},
{
name: "TERM",
symbols: [