Skip to content

Commit

Permalink
Fixes flaky test #1592
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianE committed May 25, 2021
1 parent 98dfe19 commit 63ea198
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe("RangeSliderController", () => {
withMockedMetricService()
rebuildController()
initFiles()
spyOn($rootScope, "$broadcast")
})

function withMockedMetricService() {
Expand Down Expand Up @@ -103,9 +102,11 @@ describe("RangeSliderController", () => {
})

it("should have called rzSliderForceRender", () => {
const spy = spyOn(RangeSliderController.prototype, "renderSliderOnInitialisation")

rebuildController()

expect($rootScope.$broadcast).toBeCalledWith("rzSliderForceRender")
expect(spy).toHaveBeenCalled()
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@ export class RangeSliderController
renderSliderOnInitialisation() {
// quick and dirty: Better solution would be to wait for the content to be loaded for the first render
// should be taken care of when switching to Angular

angular.element(() => {
this.$timeout(() => {
this.$rootScope.$broadcast("rzSliderForceRender")
this.forceSliderRender()
})
})
}

forceSliderRender() {
this.$rootScope.$broadcast("rzSliderForceRender")
}

onBlacklistChanged() {
if (this.isMaxMetricValueChanged()) {
this.updateMaxMetricValue()
Expand Down

0 comments on commit 63ea198

Please sign in to comment.