Commit 0f973c28 authored by Clement Ho's avatar Clement Ho

Fix specs

parent d5dee97b
......@@ -142,7 +142,14 @@
if (condition) {
tokenPath = condition.url;
} else {
tokenPath = `${keyParam}=${encodeURIComponent(token.value)}`;
let tokenValue = token.value;
if ((tokenValue[0] === '\'' && tokenValue[tokenValue.length - 1] === '\'') ||
(tokenValue[0] === '"' && tokenValue[tokenValue.length - 1] === '"')) {
tokenValue = tokenValue.slice(1, tokenValue.length - 1);
}
tokenPath = `${keyParam}=${encodeURIComponent(tokenValue)}`;
}
paths.push(tokenPath);
......
//= require extensions/array
//= require filtered_search/dropdown_utils
//= require filtered_search/filtered_search_tokenizer
//= require filtered_search/filtered_search_dropdown_manager
......@@ -80,7 +81,7 @@
getAttribute: () => 'value',
};
gl.DropdownUtils.setDataValueIfSelected(selected);
gl.DropdownUtils.setDataValueIfSelected(null, selected);
expect(gl.FilteredSearchDropdownManager.addWordToInput.calls.count()).toEqual(1);
});
......@@ -89,7 +90,7 @@
getAttribute: () => 'value',
};
const result = gl.DropdownUtils.setDataValueIfSelected(selected);
const result = gl.DropdownUtils.setDataValueIfSelected(null, selected);
expect(result).toBe(true);
});
......@@ -98,7 +99,7 @@
getAttribute: () => null,
};
const result = gl.DropdownUtils.setDataValueIfSelected(selected);
const result = gl.DropdownUtils.setDataValueIfSelected(null, selected);
expect(result).toBe(false);
});
});
......
......@@ -24,7 +24,7 @@
expect(results.tokens[0].symbol).toBe('@');
expect(results.tokens[1].key).toBe('label');
expect(results.tokens[1].value).toBe('Very Important');
expect(results.tokens[1].value).toBe('"Very Important"');
expect(results.tokens[1].symbol).toBe('~');
expect(results.tokens[2].key).toBe('milestone');
......@@ -72,7 +72,7 @@
expect(results.tokens[0].symbol).toBe('@');
expect(results.tokens[1].key).toBe('label');
expect(results.tokens[1].value).toBe('Won\'t fix');
expect(results.tokens[1].value).toBe('"Won\'t fix"');
expect(results.tokens[1].symbol).toBe('~');
expect(results.tokens[2].key).toBe('milestone');
......
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