Skip to content

Commit

Permalink
test: add relative-time test for invalid lang
Browse files Browse the repository at this point in the history
  • Loading branch information
francinelucca committed Dec 9, 2024
1 parent 048df51 commit b6136cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/relative-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,18 @@ suite('relative-time', function () {
})
}

test('renders correctly when given an invalid lang', async () => {
const now = new Date().toISOString()

const element = document.createElement('relative-time')
element.setAttribute('datetime', now)
element.setAttribute('lang', 'does-not-exist')
assert.doesNotThrow(() => element.attributeChangedCallback('lang', null, null))

await Promise.resolve()
assert.equal(element.shadowRoot.textContent, 'now')
})

suite('[tense=past]', function () {
test('always uses relative dates', async () => {
freezeTime(new Date(2033, 1, 1))
Expand Down

0 comments on commit b6136cc

Please sign in to comment.