-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make spec row clickable across entire width (#22105)
* fix: Make spec row clickable across entire width * Move click-sensitive row action wrapper to surround entire row * Add styles to highlight spec icon on hocus to match Figma * Small text highlight style change to match Figma * Add missing data-cy selector * Add tests for row expansion behaviors * Fix directory row styling issues
- Loading branch information
1 parent
e5c1f91
commit 0298b97
Showing
5 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import SpecsListRowItem from './SpecsListRowItem.vue' | ||
|
||
describe('SpecItem', () => { | ||
it('renders a SpecsListRowItem as leaf', () => { | ||
const toggleRowHandler = cy.stub() | ||
|
||
cy.mount(() => ( | ||
<SpecsListRowItem | ||
isLeaf={true} | ||
route={{ path: '/specs/runner', query: { file: '' } }} | ||
onToggleRow={toggleRowHandler} | ||
// @ts-ignore - doesn't know about vSlots | ||
vSlots={{ | ||
file: () => <span>File Name</span>, | ||
'git-info': () => <span>Git Info</span>, | ||
}} | ||
/>)) | ||
|
||
// Clicking directly on file name section should trigger row | ||
cy.get('[data-cy="specs-list-row-file"]').click() | ||
cy.wrap(toggleRowHandler).should('have.callCount', 1) | ||
|
||
// Clicking directory on git info section should trigger row | ||
cy.get('[data-cy="specs-list-row-git-info"]').click() | ||
cy.wrap(toggleRowHandler).should('have.callCount', 2) | ||
|
||
// Clicking elsewhere on row should trigger row | ||
cy.get('[data-cy="spec-item-link"]').click('right') | ||
cy.wrap(toggleRowHandler).should('have.callCount', 3) | ||
}) | ||
|
||
it('renders a SpecsListRowItem as non-leaf', () => { | ||
const toggleRowHandler = cy.stub() | ||
|
||
cy.mount(() => ( | ||
<SpecsListRowItem | ||
isLeaf={false} | ||
onToggleRow={toggleRowHandler} | ||
// @ts-ignore - doesn't know about vSlots | ||
vSlots={{ | ||
file: () => <span>Directory Name</span>, | ||
}} | ||
/>)) | ||
|
||
// Clicking directly on file name section should trigger row | ||
cy.get('[data-cy="specs-list-row-file"]').click() | ||
cy.wrap(toggleRowHandler).should('have.callCount', 1) | ||
|
||
// Clicking elsewhere on row should trigger row | ||
cy.get('[data-cy="spec-item-directory"]').click('right') | ||
cy.wrap(toggleRowHandler).should('have.callCount', 2) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
<template> | ||
<div | ||
class="h-full outline-none border-gray-50 ring-inset grid grid-cols-2 group focus-within:ring-indigo-300 focus-within:ring-1 children:cursor-pointer" | ||
data-cy="specs-list-row" | ||
> | ||
<div> | ||
<slot name="file" /> | ||
</div> | ||
|
||
<div> | ||
<slot name="git-info" /> | ||
</div> | ||
<div data-cy="specs-list-row"> | ||
<component | ||
:is="isLeaf ? 'RouterLink' : 'div'" | ||
class="h-full outline-none border-gray-50 ring-inset grid grid-cols-2 group focus:outline-transparent focus-within:ring-indigo-300 focus-within:ring-1 children:cursor-pointer" | ||
:to="route" | ||
:data-cy="isLeaf ? 'spec-item-link' : 'spec-item-directory'" | ||
@click="emit('toggleRow')" | ||
@click.meta.prevent="handleCtrlClick" | ||
@click.ctrl.prevent="handleCtrlClick" | ||
> | ||
<div data-cy="specs-list-row-file"> | ||
<slot name="file" /> | ||
</div> | ||
|
||
<div data-cy="specs-list-row-git-info"> | ||
<slot name="git-info" /> | ||
</div> | ||
</component> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { RouteLocationRaw } from 'vue-router' | ||
defineProps<{ | ||
isLeaf: boolean | ||
route?: RouteLocationRaw | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: 'toggleRow'): void | ||
}>() | ||
function handleCtrlClick (): void { | ||
// noop intended to reduce the chances of opening tests multiple tabs | ||
// which is not a supported state in Cypress | ||
} | ||
</script> |
0298b97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
0298b97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
0298b97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: