@@ -12,23 +12,30 @@ describe('remote-input', function() {
1212 } )
1313
1414 describe ( 'after tree insertion' , function ( ) {
15+ let remoteInput
16+ let input
17+ let results
18+
1519 beforeEach ( function ( ) {
1620 document . body . innerHTML = `
1721 <remote-input aria-owns="results" src="/results">
1822 <input>
1923 </remote-input>
2024 <div id="results"></div>
2125 `
26+ remoteInput = document . querySelector ( 'remote-input' )
27+ input = remoteInput . querySelector ( 'input' )
28+ results = document . querySelector ( '#results' )
2229 } )
2330
2431 afterEach ( function ( ) {
2532 document . body . innerHTML = ''
33+ remoteInput = null
34+ input = null
35+ results = null
2636 } )
2737
2838 it ( 'emits network events in order' , async function ( ) {
29- const remoteInput = document . querySelector ( 'remote-input' )
30- const input = document . querySelector ( 'input' )
31-
3239 const events = [ ]
3340 const track = event => events . push ( event . type )
3441
@@ -49,9 +56,6 @@ describe('remote-input', function() {
4956 } )
5057
5158 it ( 'loads content' , async function ( ) {
52- const remoteInput = document . querySelector ( 'remote-input' )
53- const input = document . querySelector ( 'input' )
54- const results = document . querySelector ( '#results' )
5559 assert . equal ( results . innerHTML , '' )
5660
5761 const success = once ( remoteInput , 'remote-input-success' )
@@ -66,9 +70,6 @@ describe('remote-input', function() {
6670 } )
6771
6872 it ( 'handles not ok responses' , async function ( ) {
69- const remoteInput = document . querySelector ( 'remote-input' )
70- const input = document . querySelector ( 'input' )
71- const results = document . querySelector ( '#results' )
7273 remoteInput . src = '/500'
7374 assert . equal ( results . innerHTML , '' )
7475
@@ -85,9 +86,6 @@ describe('remote-input', function() {
8586 } )
8687
8788 it ( 'handles network error' , async function ( ) {
88- const remoteInput = document . querySelector ( 'remote-input' )
89- const input = remoteInput . querySelector ( 'input' )
90- const results = document . querySelector ( '#results' )
9189 remoteInput . src = '/network-error'
9290 assert . equal ( results . innerHTML , '' )
9391
@@ -104,9 +102,6 @@ describe('remote-input', function() {
104102 } )
105103
106104 it ( 'repects param attribute' , async function ( ) {
107- const remoteInput = document . querySelector ( 'remote-input' )
108- const input = document . querySelector ( 'input' )
109- const results = document . querySelector ( '#results' )
110105 remoteInput . setAttribute ( 'param' , 'robot' )
111106 assert . equal ( results . innerHTML , '' )
112107
@@ -120,10 +115,6 @@ describe('remote-input', function() {
120115 } )
121116
122117 it ( 'loads content again after src is changed' , async function ( ) {
123- const remoteInput = document . querySelector ( 'remote-input' )
124- const input = document . querySelector ( 'input' )
125- const results = document . querySelector ( '#results' )
126-
127118 const result1 = once ( remoteInput , 'remote-input-success' )
128119 input . value = 'test'
129120 input . focus ( )
0 commit comments