Commit 976893ec authored by Clement Ho's avatar Clement Ho

Add support for labels containing single/double quote

parent 8be49531
...@@ -62,10 +62,20 @@ ...@@ -62,10 +62,20 @@
const keyMatch = this.validTokenKeys.filter(v => v.key === tokenKey)[0]; const keyMatch = this.validTokenKeys.filter(v => v.key === tokenKey)[0];
const symbolMatch = this.validTokenKeys.filter(v => v.symbol === tokenSymbol)[0]; const symbolMatch = this.validTokenKeys.filter(v => v.symbol === tokenSymbol)[0];
if (tokenValue.indexOf('"') !== -1) { const doubleQuoteIndex = tokenValue.indexOf('"');
const singleQuoteIndex = tokenValue.indexOf('\'');
const doubleQuoteExist = doubleQuoteIndex !== -1;
const singleQuoteExist = singleQuoteIndex !== -1;
if ((doubleQuoteExist && !singleQuoteExist) ||
(doubleQuoteExist && singleQuoteExist && doubleQuoteIndex < singleQuoteIndex)) {
// " is found and is in front of ' (if any)
lastQuotation = '"'; lastQuotation = '"';
incompleteToken = true; incompleteToken = true;
} else if (tokenValue.indexOf('\'') !== -1) { } else if ((singleQuoteExist && !doubleQuoteExist) ||
(doubleQuoteExist && singleQuoteExist && singleQuoteIndex < doubleQuoteIndex)) {
// ' is found and is in front of " (if any)
lastQuotation = '\''; lastQuotation = '\'';
incompleteToken = true; incompleteToken = true;
} }
......
...@@ -242,14 +242,12 @@ describe 'Filter issues', feature: true do ...@@ -242,14 +242,12 @@ describe 'Filter issues', feature: true do
end end
it 'single quotes containing double quotes' do it 'single quotes containing double quotes' do
# TODO: Actual bug double_quotes_label = create(:label, project: project, title: 'won"t fix')
double_quotes_label_issue = create(:issue, title: "Issue with double quotes label", project: project)
double_quotes_label_issue.labels << double_quotes_label
# double_quotes_label = create(:label, project: project, title: 'won"t fix') input_filtered_search("label:~'#{double_quotes_label.title}'")
# double_quotes_label_issue = create(:issue, title: "Issue with double quotes label", project: project) expect_issues_list_count(1)
# double_quotes_label_issue.labels << double_quotes_label
# input_filtered_search("label:'#{double_quotes_label.title}'")
# expect_issues_list_count(1)
end end
it 'double quotes containing single quotes' do it 'double quotes containing single quotes' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment