Browse Source

fix: checkbox cypress error

zhangyumei.0319 3 years ago
parent
commit
ed82bc86e6

+ 2 - 2
cypress/integration/checkbox.spec.js

@@ -3,9 +3,9 @@ describe('checkbox', () => {
         cy.visit('http://127.0.0.1:6006/iframe.html?id=checkbox--checkbox-group-demo&args=&viewMode=story');
         cy.get('.semi-checkbox').eq(0).click();
         cy.focused().tab();
-        cy.get('.semi-checkbox-focus').type('{backspace}');
+        cy.focused().type('{backspace}');
         cy.get('.semi-checkbox').eq(1).get('.semi-checkbox-checked');
-        cy.get('.semi-checkbox-focus').type('{backspace}');
+        cy.focused().type('{backspace}');
         cy.get('.semi-checkbox').eq(1).get('.semi-checkbox-unChecked');
     });
 

+ 1 - 1
packages/semi-foundation/checkbox/checkboxFoundation.ts

@@ -131,7 +131,7 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
     handleFocusVisible = (event: any) => {
         const { target } = event;
         try {
-            if( this.clickState ) {
+            if (this.clickState) {
                 this.clickState = false;
                 return;
             }