@@ -85,7 +85,15 @@ describe('SelectorPlayground', () => {
85
85
cy . get ( '[data-cy="playground-num-elements"]' ) . contains ( 'Invalid' )
86
86
} )
87
87
88
- it ( 'focuses and copies selector text' , ( ) => {
88
+ it ( 'focuses playground selector' , ( ) => {
89
+ mountSelectorPlayground ( )
90
+ cy . get ( '[data-cy="playground-selector"]' ) . as ( 'copy' ) . clear ( ) . type ( '.foo-bar' )
91
+
92
+ cy . get ( '@copy' ) . click ( )
93
+ cy . get ( '@copy' ) . should ( 'be.focused' )
94
+ } )
95
+
96
+ it ( 'copies selector text' , ( ) => {
89
97
const copyStub = cy . stub ( )
90
98
91
99
cy . stubMutationResolver ( Clipboard_CopyToClipboardDocument , ( defineResult , { text } ) => {
@@ -100,18 +108,13 @@ describe('SelectorPlayground', () => {
100
108
101
109
cy . spy ( autIframe , 'toggleSelectorHighlight' )
102
110
103
- cy . get ( '[data-cy="playground-selector"]' ) . as ( 'copy' ) . clear ( ) . type ( '.foo-bar' )
104
-
105
- cy . get ( '@copy' ) . click ( )
106
- cy . get ( '@copy' ) . should ( 'be.focused' )
107
-
108
111
cy . get ( '[data-cy="playground-copy"]' ) . trigger ( 'mouseenter' )
109
112
cy . get ( '[data-cy="selector-playground-tooltip"]' ) . should ( 'be.visible' ) . contains ( 'Copy to clipboard' )
110
113
111
114
cy . get ( '[data-cy="playground-copy"]' ) . click ( )
112
115
cy . get ( '[data-cy="selector-playground-tooltip"]' ) . should ( 'be.visible' ) . contains ( 'Copied!' )
113
116
114
- cy . wrap ( copyStub ) . should ( 'have.been.calledWith' , 'cy.get(\'.foo-bar \')' )
117
+ cy . wrap ( copyStub ) . should ( 'have.been.calledWith' , 'cy.get(\'body \')' )
115
118
} )
116
119
117
120
it ( 'prints elements when selected elements found' , ( ) => {
0 commit comments