Bug 693: Remove "kk"/normalization property from Collator

This commit is contained in:
Norbert Lindenberg 2012-10-09 22:19:30 -07:00
parent ffe73305c6
commit 8f6a50843a
5 changed files with 12 additions and 10 deletions

View File

@ -9,7 +9,7 @@
$INCLUDE("testIntl.js");
taintProperties(["localeMatcher", "kn", "kk", "kf"]);
taintProperties(["localeMatcher", "kn", "kf"]);
var locale = new Intl.Collator(undefined, {localeMatcher: "lookup"}).resolvedOptions().locale;
if (!isCanonicalizedStructurallyValidLanguageTag(locale)) {

View File

@ -2,13 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that the options numeric, normalization, and caseFirst are processed correctly.
* @description Tests that the options numeric and caseFirst are processed correctly.
* @author Norbert Lindenberg
*/
$INCLUDE("testIntl.js");
testOption(Intl.Collator, "numeric", "boolean", undefined, undefined, {isOptional: true});
testOption(Intl.Collator, "normalization", "boolean", undefined, undefined, {isOptional: true});
testOption(Intl.Collator, "caseFirst", "string", ["upper", "lower", "false"], undefined, {isOptional: true});

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that the options numeric, normalization, and caseFirst can be
* @description Tests that the options numeric and caseFirst can be
* set through either the locale or the options.
* @author Norbert Lindenberg
*/
@ -11,7 +11,6 @@ $INCLUDE("testIntl.js");
var options = [
{key: "kn", property: "numeric", type: "boolean", values: [true, false]},
{key: "kk", property: "normalization", type: "boolean", values: [true, false]},
{key: "kf", property: "caseFirst", type: "string", values: ["upper", "lower", "false"]}
];

View File

@ -9,12 +9,18 @@
$INCLUDE("testIntl.js");
var testArray = [
"hello", "你好", "こんにちは",
"pêche", "peché", "1", "9", "10",
"ụ\u031B", "u\u031B\u0323", "ư\u0323", "u\u0323\u031B",
"Å", "Å", "A\u030A"
];
var defaultCollator = new Intl.Collator();
var defaultOptions = defaultCollator.resolvedOptions();
var defaultOptionsJSON = JSON.stringify(defaultOptions);
var defaultLocale = defaultOptions.locale;
var defaultSortedArray = ["hello", "你好", "こんにちは", "pêche", "peché", "9", "10"].sort(defaultCollator.compare);
var defaultSortedArray = testArray.slice(0).sort(defaultCollator.compare);
var keyValues = {
"co": ["standard", "search", "invalid"],
@ -22,13 +28,12 @@ var keyValues = {
"kb": ["true", "false", "invalid"],
"kc": ["true", "false", "invalid"],
"kh": ["true", "false", "invalid"],
"kk": ["true", "false", "invalid"],
"kr": ["latn-hira-hani", "hani-hira-latn", "invalid"],
"ks": ["level1", "level2", "level3", "level4", "identic", "invalid"],
"vt": ["1234-5678-9abc-edf0", "invalid"]
};
var testArray = defaultSortedArray.slice(0);
Object.getOwnPropertyNames(keyValues).forEach(function (key) {
keyValues[key].forEach(function (value) {
var collator = new Intl.Collator([defaultLocale + "-u-" + key + "-" + value]);

View File

@ -43,6 +43,5 @@ mustHaveProperty(actual, "sensitivity", ["variant"]);
mustHaveProperty(actual, "ignorePunctuation", [false]);
mustHaveProperty(actual, "collation", collations);
mayHaveProperty(actual, "numeric", [true, false]);
mayHaveProperty(actual, "normalization", [true, false]);
mayHaveProperty(actual, "caseFirst", ["upper", "lower", "false"]);