Skip to content

Commit

Permalink
fix typo in observed attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 23, 2022
1 parent cc5096d commit e229db7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/relative-time-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class RelativeTimeElement extends HTMLElement implements Intl.Dat
'year',
'time-zone-name',
'prefix',
'threhsold',
'threshold',
'tense',
'precision',
'format',
Expand Down
13 changes: 13 additions & 0 deletions test/relative-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ suite('relative-time', function () {
assert.notEqual(nextDisplay, display)
})

test('all observedAttributes have getters', async function () {
const ALLOWED_PROPERTIES = ['time-zone-name']

const members = [
...Object.getOwnPropertyNames(RelativeTimeElement.prototype),
...Object.getOwnPropertyNames(HTMLElement.prototype),
...ALLOWED_PROPERTIES
]
const observedAttributes = new Set(RelativeTimeElement.observedAttributes)
for (const member of members) observedAttributes.delete(member)
assert.empty([...observedAttributes], 'observedAttributes that arent class members')
})

test("doesn't error when no date is provided", function () {
const element = document.createElement('relative-time')
assert.doesNotThrow(() => element.attributeChangedCallback('datetime', null, null))
Expand Down

0 comments on commit e229db7

Please sign in to comment.