|
1 | 1 | import { expect } from '@esm-bundle/chai'; |
2 | | -import { fixtureSync, nextFrame } from '@open-wc/testing-helpers'; |
3 | 2 | import sinon from 'sinon'; |
4 | | -import { keyDownOn, keyUpOn, touchstart, touchend } from '@polymer/iron-test-helpers/mock-interactions.js'; |
| 3 | +import { fixtureSync, nextFrame, space, spaceKeyDown, spaceKeyUp, touchstart, touchend } from '@vaadin/testing-helpers'; |
5 | 4 | import { down, up } from './helpers.js'; |
6 | 5 | import '../vaadin-radio-button.js'; |
7 | 6 |
|
@@ -103,8 +102,7 @@ describe('radio-button', () => { |
103 | 102 | }); |
104 | 103 |
|
105 | 104 | it('should set checked on space keyup', () => { |
106 | | - keyDownOn(radio, 32); |
107 | | - keyUpOn(radio, 32); |
| 105 | + space(radio); |
108 | 106 | expect(radio.checked).to.be.true; |
109 | 107 | }); |
110 | 108 | }); |
@@ -132,21 +130,19 @@ describe('radio-button', () => { |
132 | 130 | }); |
133 | 131 |
|
134 | 132 | it('should not set checked on space keyup when disabled', () => { |
135 | | - keyDownOn(radio, 32); |
136 | | - keyUpOn(radio, 32); |
| 133 | + space(radio); |
137 | 134 | expect(radio.checked).to.be.false; |
138 | 135 | }); |
139 | 136 | }); |
140 | 137 |
|
141 | 138 | describe('active attribute', () => { |
142 | 139 | it('should have active attribute on space keydown', () => { |
143 | | - keyDownOn(radio, 32); |
| 140 | + spaceKeyDown(radio); |
144 | 141 | expect(radio.hasAttribute('active')).to.be.true; |
145 | 142 | }); |
146 | 143 |
|
147 | 144 | it('should not have active attribute on space keyup', () => { |
148 | | - keyDownOn(radio, 32); |
149 | | - keyUpOn(radio, 32); |
| 145 | + space(radio); |
150 | 146 | expect(radio.hasAttribute('active')).to.be.false; |
151 | 147 | }); |
152 | 148 | }); |
@@ -179,15 +175,13 @@ describe('radio-button', () => { |
179 | 175 | }); |
180 | 176 |
|
181 | 177 | it('should be called on space keyup', () => { |
182 | | - keyDownOn(radio, 32); |
183 | | - keyUpOn(radio, 32); |
| 178 | + space(radio); |
184 | 179 | expect(spy.calledOnce).to.be.true; |
185 | 180 | }); |
186 | 181 |
|
187 | 182 | it('should not be called on space keyup when disabled', () => { |
188 | 183 | radio.disabled = true; |
189 | | - keyDownOn(radio, 32); |
190 | | - keyUpOn(radio, 32); |
| 184 | + space(radio); |
191 | 185 | expect(spy.called).to.be.false; |
192 | 186 | }); |
193 | 187 | }); |
@@ -218,9 +212,10 @@ describe('radio-button', () => { |
218 | 212 | }); |
219 | 213 |
|
220 | 214 | it('should fire on space keyup', () => { |
221 | | - keyDownOn(radio, 32); |
| 215 | + spaceKeyDown(radio); |
222 | 216 | expect(spy.called).to.be.false; |
223 | | - keyUpOn(radio, 32); |
| 217 | + |
| 218 | + spaceKeyUp(radio); |
224 | 219 | expect(spy.calledOnce).to.be.true; |
225 | 220 | }); |
226 | 221 |
|
|
0 commit comments