Skip to content

Commit 4508bfb

Browse files
koddssontheinterned
andcommitted
Replace chai-spies with sinon
Co-authored-by: Ned Schwartz <[email protected]>
1 parent 5d8fb45 commit 4508bfb

File tree

4 files changed

+137
-94
lines changed

4 files changed

+137
-94
lines changed

test/auto-shadow-root.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {expect} from '@open-wc/testing'
2+
import {replace, fake} from 'sinon'
23
import {autoShadowRoot} from '../lib/auto-shadow-root.js'
34

45
describe('autoShadowRoot', () => {
@@ -75,15 +76,19 @@ describe('autoShadowRoot', () => {
7576
instance.appendChild(template)
7677

7778
let shadowRoot = null
78-
chai.spy.on(instance, 'attachShadow', (...args) => {
79-
shadowRoot = Element.prototype.attachShadow.apply(instance, args)
80-
return shadowRoot
81-
})
79+
replace(
80+
instance,
81+
'attachShadow',
82+
fake((...args) => {
83+
shadowRoot = Element.prototype.attachShadow.apply(instance, args)
84+
return shadowRoot
85+
})
86+
)
8287

8388
autoShadowRoot(instance)
8489

8590
expect(instance).to.have.property('shadowRoot').equal(null)
86-
expect(instance.attachShadow).to.have.been.called.once.with.exactly({mode: 'closed'})
91+
expect(instance.attachShadow).to.have.been.calledOnceWith({mode: 'closed'})
8792
expect(shadowRoot.textContent).to.equal('Hello World')
8893
})
8994
})

0 commit comments

Comments
 (0)