diff options
author | Norbert Lindenberg <ecmascript@lindenbergsoftware.com> | 2012-08-26 20:50:24 -0700 |
---|---|---|
committer | Norbert Lindenberg <ecmascript@lindenbergsoftware.com> | 2012-08-26 20:50:24 -0700 |
commit | d71ffa59d5fa2df454bf1c1853b0ccfc87fe3bcd (patch) | |
tree | 79aed459cf2d8f9d26f8e0ece825d5e20b1d4650 /test/suite/intl402/ch10/10.1/10.1.2_a.js | |
parent | 1af24250750e0a4318ec8efb467245fa0e86c215 (diff) |
Added new tests for chapters 10 to 13 of the ECMAScript Internationalization API Specification.
Diffstat (limited to 'test/suite/intl402/ch10/10.1/10.1.2_a.js')
-rw-r--r-- | test/suite/intl402/ch10/10.1/10.1.2_a.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/suite/intl402/ch10/10.1/10.1.2_a.js b/test/suite/intl402/ch10/10.1/10.1.2_a.js new file mode 100644 index 000000000..de69a4809 --- /dev/null +++ b/test/suite/intl402/ch10/10.1/10.1.2_a.js @@ -0,0 +1,30 @@ +// Copyright 2011-2012 Norbert Lindenberg. All rights reserved. +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Intl.Collator can be subclassed. + * @author Norbert Lindenberg + */ + +$INCLUDE("testIntl.js"); + +// get a collator and have it sort an array for comparison with the subclass +var locales = ["tlh", "id", "en"]; +var a = ["A", "C", "E", "B", "D", "F"]; +var referenceCollator = new Intl.Collator(locales); +var referenceSorted = a.slice().sort(referenceCollator.compare); + +function MyCollator(locales, options) { + Intl.Collator.call(this, locales, options); + // could initialize MyCollator properties +} + +MyCollator.prototype = Object.create(Intl.Collator.prototype); +MyCollator.prototype.constructor = MyCollator; +// could add methods to MyCollator.prototype + +var collator = new MyCollator(locales); +a.sort(collator.compare); +testArraysAreSame(referenceSorted, a); + |