diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/main.js b/test/intl402/DateTimeFormat/prototype/formatToParts/main.js index d00414b1267e598149df129d2dd62947ef5f52ce..75e7686f3d056a074ba9b5dbaa6eb7cd2926cc39 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/main.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/main.js @@ -38,3 +38,39 @@ compareFTPtoFormat(['ar'], { day: 'numeric', year: '2-digit' }, Date.now()); + +const actualPartTypes = new Intl.DateTimeFormat('en-us', { + weekday: 'long', + era: 'long', + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + hour12: true, + timeZone: 'UTC', + timeZoneName: 'long' +}).formatToParts(Date.UTC(2012, 11, 17, 3, 0, 42)) + .map(function (part) { return part.type; }); + +const legalPartTypes = [ + "weekday", + "era", + "year", + "month", + "day", + "hour", + "minute", + "second", + "literal", + "dayPeriod", + "timeZoneName" +]; + +actualPartTypes.forEach( + function (type) { + assert( + legalPartTypes.indexOf(type) !== -1, + type + " is not a legal type"); + });