Skip to content

Commit

Permalink
feat(component): combobox (#83)
Browse files Browse the repository at this point in the history
* Refactor data-ids usage.
* Update Adobe packages.
* Implement ComboBox component
* Update and add tests to Select
* Implement ProgrressCircle component
* Add loadMore support to Popup
  • Loading branch information
mnapthine authored Apr 26, 2023
1 parent 7ba58eb commit f4e7dd9
Show file tree
Hide file tree
Showing 106 changed files with 7,851 additions and 4,043 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- run: npm ci
Expand All @@ -27,7 +27,7 @@ jobs:
needs: install
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
Expand All @@ -43,14 +43,14 @@ jobs:
id: types-artefact
with:
path: st-types
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('st-types') }}

lint:
runs-on: ubuntu-latest
needs: build-types
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -69,15 +69,15 @@ jobs:
id: types-artefact
with:
path: st-types
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('st-types') }}
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
needs: build-types
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -96,15 +96,15 @@ jobs:
id: types-artefact
with:
path: st-types
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('st-types') }}
- run: npm run typecheck

unit-tests:
runs-on: ubuntu-latest
needs: [lint, typecheck]
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -123,15 +123,15 @@ jobs:
id: types-artefact
with:
path: st-types
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('st-types') }}
- run: npm run unit-tests

cypress-component-tests:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.15.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -150,5 +150,5 @@ jobs:
id: types-artefact
with:
path: st-types
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}-types-artefact-${{ github.ref }}-${{ hashFiles('st-types') }}
- run: npm run cypress run --component
4 changes: 4 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const globalTypes = {
value: themes["shelley"],
title: "Shelley",
},
{
value: themes["shelleyLight"],
title: "ShelleyLight",
},
],
},
},
Expand Down
2 changes: 2 additions & 0 deletions cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ module.exports = defineConfig({
bundler: "webpack",
},
},
viewportWidth: 500,
viewportHeight: 500,
});
1 change: 1 addition & 0 deletions cypress.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mount } from "cypress/react";
import "cypress-real-events";

declare global {
namespace Cypress {
Expand Down
20 changes: 10 additions & 10 deletions cypress/component/Checkbox.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import React from "react";
import { Checkbox } from "../../src/indexLib";

const checkboxWithLabel = '[data-id="checkbox--label"]';
const checkboxWithoutLabel = '[data-id="checkbox--no-label"]';
const checkboxWithoutLabel = '[data-id="checkbox--noLabel"]';
const inputEl = '[data-id="checkbox--input"]';

describe("Checkbox", () => {
it("renders child as label, unchecked by default", () => {
cy.mount(<Checkbox includeDataIds>Subscribe</Checkbox>);
cy.mount(<Checkbox data-id="checkbox">Subscribe</Checkbox>);
cy.get(checkboxWithLabel).contains("Subscribe");
cy.get(inputEl).should("not.be.checked");
});

it("defaultSelected", () => {
cy.mount(
<Checkbox defaultSelected includeDataIds>
<Checkbox defaultSelected data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -24,7 +24,7 @@ describe("Checkbox", () => {
it("fires onChange when clicking label", () => {
const onChangeSpy = cy.spy().as("onChangeSpy");
cy.mount(
<Checkbox onChange={onChangeSpy} includeDataIds>
<Checkbox onChange={onChangeSpy} data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -35,7 +35,7 @@ describe("Checkbox", () => {
it("isDisabled", () => {
const onChangeSpy = cy.spy().as("onChangeSpy");
cy.mount(
<Checkbox onChange={onChangeSpy} isDisabled includeDataIds>
<Checkbox onChange={onChangeSpy} isDisabled data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -48,7 +48,7 @@ describe("Checkbox", () => {
it("isReadOnly", () => {
const onChangeSpy = cy.spy().as("onChangeSpy");
cy.mount(
<Checkbox onChange={onChangeSpy} isReadOnly includeDataIds>
<Checkbox onChange={onChangeSpy} isReadOnly data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -59,7 +59,7 @@ describe("Checkbox", () => {
it("isIndeterminate has class and fires onChange", () => {
const onChangeSpy = cy.spy().as("onChangeSpy");
cy.mount(
<Checkbox onChange={onChangeSpy} isIndeterminate includeDataIds>
<Checkbox onChange={onChangeSpy} isIndeterminate data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -71,7 +71,7 @@ describe("Checkbox", () => {
});

it("focus class added", () => {
cy.mount(<Checkbox includeDataIds>Subscribe</Checkbox>);
cy.mount(<Checkbox data-id="checkbox">Subscribe</Checkbox>);
cy.get(inputEl).focus();
cy.get(checkboxWithLabel)
.should("have.attr", "class")
Expand All @@ -80,7 +80,7 @@ describe("Checkbox", () => {

it("renders with custom class name", () => {
cy.mount(
<Checkbox className="cypress-test" includeDataIds>
<Checkbox className="cypress-test" data-id="checkbox">
Subscribe
</Checkbox>
);
Expand All @@ -94,7 +94,7 @@ describe("Checkbox", () => {
cy.mount(
<>
<label htmlFor="test123">Custom label</label>
<Checkbox id="test123" includeDataIds />
<Checkbox id="test123" data-id="checkbox" />
</>
);
cy.get(checkboxWithoutLabel).should("exist");
Expand Down
Loading

0 comments on commit f4e7dd9

Please sign in to comment.