Skip to content

Commit cf0cd70

Browse files
committed
fix: add missing test
1 parent 4d0f790 commit cf0cd70

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/relative-time.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,5 +2629,19 @@ suite('relative-time', function () {
26292629
// Should fallback to default or system time zone
26302630
assert.equal(el.shadowRoot.textContent, 'Wed, Jan 1, 2020, 4:00:00 PM')
26312631
})
2632+
2633+
test('uses html time-zone if element time-zone is empty', async () => {
2634+
const time = document.createElement('relative-time')
2635+
time.setAttribute('datetime', '2020-01-01T12:00:00.000Z')
2636+
time.setAttribute('time-zone', '')
2637+
document.documentElement.setAttribute('time-zone', 'Asia/Tokyo')
2638+
time.setAttribute('format', 'datetime')
2639+
time.setAttribute('hour', 'numeric')
2640+
time.setAttribute('minute', '2-digit')
2641+
time.setAttribute('second', '2-digit')
2642+
await Promise.resolve()
2643+
assert.equal(time.shadowRoot.textContent, 'Wed, Jan 1, 2020, 9:00:00 PM')
2644+
document.documentElement.removeAttribute('time-zone')
2645+
})
26322646
})
26332647
})

0 commit comments

Comments
 (0)