From c42eaa76fe23ca204e2135263c20ec809882b808 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Tue, 15 Aug 2023 09:04:58 -0700 Subject: [PATCH] test: Readable order for ad test setup (#5468) For readability, the order of before*/after* functions should be the same as their execution order: - beforeAll - beforeEach - afterEach - afterAll This fixes the order for ad tests. --- test/ui/ad_ui_unit.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/ui/ad_ui_unit.js b/test/ui/ad_ui_unit.js index 35cc66e4b4..acc325e26b 100644 --- a/test/ui/ad_ui_unit.js +++ b/test/ui/ad_ui_unit.js @@ -25,15 +25,6 @@ describe('Ad UI', () => { shaka.Player.setAdManagerFactory(() => new shaka.test.FakeAdManager()); }); - afterEach(async () => { - await UiUtils.cleanupUI(); - }); - - afterAll(() => { - document.head.removeChild(cssLink); - shaka.Player.setAdManagerFactory(() => new shaka.ads.AdManager()); - }); - beforeEach(() => { container = /** @type {!HTMLElement} */ (document.createElement('div')); @@ -45,6 +36,15 @@ describe('Ad UI', () => { adManager = video['ui'].getControls().getPlayer().getAdManager(); }); + afterEach(async () => { + await UiUtils.cleanupUI(); + }); + + afterAll(() => { + document.head.removeChild(cssLink); + shaka.Player.setAdManagerFactory(() => new shaka.ads.AdManager()); + }); + it('is invisible if no ad is playing', () => { const adControlsContainer = UiUtils.getElementByClassName(container, 'shaka-ad-controls');