Skip to content

Commit b643852

Browse files
authored
Merge pull request #212 from github/fix-typo-in-observed-attributes
fix typo in observed attributes
2 parents cc5096d + e229db7 commit b643852

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/relative-time-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default class RelativeTimeElement extends HTMLElement implements Intl.Dat
9797
'year',
9898
'time-zone-name',
9999
'prefix',
100-
'threhsold',
100+
'threshold',
101101
'tense',
102102
'precision',
103103
'format',

test/relative-time.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ suite('relative-time', function () {
7878
assert.notEqual(nextDisplay, display)
7979
})
8080

81+
test('all observedAttributes have getters', async function () {
82+
const ALLOWED_PROPERTIES = ['time-zone-name']
83+
84+
const members = [
85+
...Object.getOwnPropertyNames(RelativeTimeElement.prototype),
86+
...Object.getOwnPropertyNames(HTMLElement.prototype),
87+
...ALLOWED_PROPERTIES
88+
]
89+
const observedAttributes = new Set(RelativeTimeElement.observedAttributes)
90+
for (const member of members) observedAttributes.delete(member)
91+
assert.empty([...observedAttributes], 'observedAttributes that arent class members')
92+
})
93+
8194
test("doesn't error when no date is provided", function () {
8295
const element = document.createElement('relative-time')
8396
assert.doesNotThrow(() => element.attributeChangedCallback('datetime', null, null))

0 commit comments

Comments
 (0)