@@ -19,12 +19,14 @@ import * as ApplicationComponents from './components.js';
1919
2020async function renderBounceTrackingMitigationsView ( ) :
2121 Promise < ApplicationComponents . BounceTrackingMitigationsView . BounceTrackingMitigationsView > {
22- const component = new ApplicationComponents . BounceTrackingMitigationsView . BounceTrackingMitigationsView ( ) ;
23- component . style . display = 'block' ;
24- component . style . width = '640px' ;
25- component . style . height = '480px' ;
22+ const element = document . createElement ( 'div' ) ;
23+ element . style . display = 'block' ;
24+ element . style . width = '640px' ;
25+ element . style . height = '480px' ;
26+ const component = new ApplicationComponents . BounceTrackingMitigationsView . BounceTrackingMitigationsView ( element ) ;
2627 renderElementIntoDOM ( component ) ;
2728
29+ await component . updateComplete ;
2830 // The data-grid's renderer is scheduled, so we need to wait until the coordinator
2931 // is done before we can test against it.
3032 await RenderCoordinator . done ( ) ;
@@ -34,7 +36,7 @@ async function renderBounceTrackingMitigationsView():
3436
3537function getInternalDataGridShadowRoot (
3638 component : ApplicationComponents . BounceTrackingMitigationsView . BounceTrackingMitigationsView ) : ShadowRoot {
37- const dataGrid = component . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ! ;
39+ const dataGrid = component . element . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ! ;
3840 assert . isNotNull ( dataGrid . shadowRoot ) ;
3941 return dataGrid . shadowRoot ;
4042}
@@ -47,14 +49,14 @@ describeWithMockConnection('BounceTrackingMitigationsView', () => {
4749
4850 const component = await renderBounceTrackingMitigationsView ( ) ;
4951 await RenderCoordinator . done ( ) ;
50- await component . wrapper ?. updateComplete ;
52+ await component . updateComplete ;
5153
52- const nullGridElement = component . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
54+ const nullGridElement = component . element . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
5355 assert . isNull ( nullGridElement ) ;
5456
5557 await assertScreenshot ( 'application/bounce-tracking-mitigations-view-initial.png' ) ;
5658
57- const sections = component . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
59+ const sections = component . element . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
5860 const sectionsText = Array . from ( sections ) . map ( section => section . textContent ?. trim ( ) ) ;
5961 const expected = [
6062 'Force run' ,
@@ -70,14 +72,14 @@ describeWithMockConnection('BounceTrackingMitigationsView', () => {
7072
7173 const component = await renderBounceTrackingMitigationsView ( ) ;
7274 await RenderCoordinator . done ( ) ;
73- await component . wrapper ?. updateComplete ;
75+ await component . updateComplete ;
7476
75- const nullGridElement = component . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
77+ const nullGridElement = component . element . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
7678 assert . isNull ( nullGridElement ) ;
7779
7880 await assertScreenshot ( 'application/bounce-tracking-mitigations-view-disabled.png' ) ;
7981
80- const sections = component . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
82+ const sections = component . element . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
8183 const sectionsText = Array . from ( sections ) . map ( section => section . textContent ?. trim ( ) ) ;
8284 const expected = [
8385 'Bounce tracking mitigations are disabled.' ,
@@ -98,22 +100,22 @@ describeWithMockConnection('BounceTrackingMitigationsView', () => {
98100
99101 const component = await renderBounceTrackingMitigationsView ( ) ;
100102 await RenderCoordinator . done ( ) ;
101- await component . wrapper ?. updateComplete ;
103+ await component . updateComplete ;
102104
103- const forceRunButton = component . shadowRoot ! . querySelector ( '[aria-label="Force run"]' ) ;
105+ const forceRunButton = component . element . shadowRoot ! . querySelector ( '[aria-label="Force run"]' ) ;
104106 assert . instanceOf ( forceRunButton , HTMLElement ) ;
105107 dispatchClickEvent ( forceRunButton ) ;
106108 await runBounceTrackingMitigationsPromise ;
107109
108110 await RenderCoordinator . done ( ) ;
109- await component . wrapper ?. updateComplete ;
111+ await component . updateComplete ;
110112
111113 await assertScreenshot ( 'application/bounce-tracking-mitigations-view-empty.png' ) ;
112114
113- const nullGridElement = component . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
115+ const nullGridElement = component . element . shadowRoot ! . querySelector ( 'devtools-data-grid' ) ;
114116 assert . isNull ( nullGridElement ) ;
115117
116- const sections = component . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
118+ const sections = component . element . shadowRoot ! . querySelectorAll ( 'devtools-report-section' ) ;
117119 const sectionsText = Array . from ( sections ) . map ( section => section . textContent ?. trim ( ) ) ;
118120 const expected = [
119121 'Force run' ,
@@ -132,14 +134,14 @@ describeWithMockConnection('BounceTrackingMitigationsView', () => {
132134
133135 const component = await renderBounceTrackingMitigationsView ( ) ;
134136 await RenderCoordinator . done ( ) ;
135- await component . wrapper ?. updateComplete ;
137+ await component . updateComplete ;
136138
137- const forceRunButton = component . shadowRoot ! . querySelector ( '[aria-label="Force run"]' ) ;
139+ const forceRunButton = component . element . shadowRoot ! . querySelector ( '[aria-label="Force run"]' ) ;
138140 assert . instanceOf ( forceRunButton , HTMLElement ) ;
139141 dispatchClickEvent ( forceRunButton ) ;
140142
141143 await RenderCoordinator . done ( { waitForWork : true } ) ;
142- await component . wrapper ?. updateComplete ;
144+ await component . updateComplete ;
143145
144146 await assertScreenshot ( 'application/bounce-tracking-mitigations-view-populated.png' ) ;
145147
0 commit comments