diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/related-year.js b/test/intl402/DateTimeFormat/prototype/formatToParts/related-year.js new file mode 100644 index 0000000000..4f01d98c2d --- /dev/null +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/related-year.js @@ -0,0 +1,20 @@ +// Copyright 2019 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-partitiondatetimepattern +description: Checks the output of 'relatedYear' and 'yearName' type, and + the choose of pattern base on calendar. +locale: [en-u-ca-chinese] +---*/ + +let df = new Intl.DateTimeFormat("en-u-ca-chinese", {year: "numeric"}); +let parts = df.formatToParts(new Date()); +var relatedYearCount = 0; +var yearNameCount = 0; +parts.forEach(function(part) { + relatedYearCount += (part.type == "relatedYear") ? 1 : 0; + yearNameCount += (part.type == "yearName") ? 1 : 0; +}); +assert.sameValue(relatedYearCount > 0, true); +assert.sameValue(yearNameCount > 0, true);