mirror of
https://github.com/tc39/test262.git
synced 2025-09-25 11:08:49 +02:00
Checking whether an object implements the TimeZone protocol is now done by means of HasProperty operations for each of the required methods unless the object already has the TimeZone brand. Discussion: https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753 Corresponding normative PR: https://github.com/tc39/proposal-temporal/pull/2485
31 lines
1023 B
JavaScript
31 lines
1023 B
JavaScript
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-temporal.now.plaindatetimeiso
|
|
description: Correctly invokes `getOffsetNanosecondsFor` method of TimeZone-like objects
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
var calls = [];
|
|
var timeZone = {
|
|
id: 'Etc/Test',
|
|
getPossibleInstantsFor() { return []; },
|
|
getOffsetNanosecondsFor: function() {
|
|
calls.push({
|
|
args: arguments,
|
|
this: this
|
|
});
|
|
return 0;
|
|
},
|
|
};
|
|
|
|
Temporal.Now.plainDateTimeISO(timeZone);
|
|
|
|
assert.sameValue(calls.length, 1, 'The value of calls.length is expected to be 1');
|
|
assert.sameValue(calls[0].args.length, 1, 'The value of calls[0].args.length is expected to be 1');
|
|
assert(
|
|
calls[0].args[0] instanceof Temporal.Instant,
|
|
'The result of evaluating (calls[0].args[0] instanceof Temporal.Instant) is expected to be true'
|
|
);
|
|
assert.sameValue(calls[0].this, timeZone, 'The value of calls[0].this is expected to equal the value of timeZone');
|