Skip to content

Commit

Permalink
add mock load events to classifier tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourgreens committed Dec 23, 2024
1 parent 9a0ab20 commit 3f561d1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,23 @@ describe('Components > Classifier', function () {
constructor () {
this.naturalHeight = 1000
this.naturalWidth = 500
setTimeout(() => this.onload(), 500)
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => this.onload(fakeLoadEvent), 500)
}
}

class MockSlowImage {
constructor () {
this.naturalHeight = 1000
this.naturalWidth = 500
setTimeout(() => this.onload(), 5000)
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => this.onload(fakeLoadEvent), 5000)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ function testWorkflow(workflowSnapshot, workflowStrings) {
constructor () {
this.naturalHeight = 1000
this.naturalWidth = 500
setTimeout(() => this.onload(), 500)
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => this.onload(fakeLoadEvent), 500)
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ describe('components > ClassifierContainer', function () {
constructor () {
this.naturalHeight = 1000
this.naturalWidth = 500
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => {
this.onload()
this.onload(fakeLoadEvent)
}, 500)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ describe('Component > MultiFrameViewerContainer', function () {
constructor () {
this.naturalHeight = height
this.naturalWidth = width
setTimeout(() => this.onload(), DELAY)
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => this.onload(fakeLoadEvent), DELAY)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ describe('Component > SingleImageViewerContainer', function () {
constructor () {
this.naturalHeight = height
this.naturalWidth = width
setTimeout(() => this.onload(), DELAY)
const fakeLoadEvent = {
...new Event('load'),
target: this
}
setTimeout(() => this.onload(fakeLoadEvent), DELAY)
}
}

Expand Down

0 comments on commit 3f561d1

Please sign in to comment.