-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
220ee6c
commit cecc87c
Showing
29 changed files
with
772 additions
and
2,132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
/* eslint-disable jest/expect-expect */ | ||
|
||
context('Click', () => { | ||
beforeEach(() => { | ||
cy.viewport(800, 600) | ||
|
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,5 +1,3 @@ | ||
/* eslint-disable jest/expect-expect */ | ||
|
||
context('Scroll', () => { | ||
beforeEach(() => { | ||
cy.viewport(800, 600) | ||
|
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 |
---|---|---|
|
@@ -19,11 +19,11 @@ | |
"lint:styles": "stylelint 'src/**/*.css'", | ||
"lint": "concurrently 'yarn lint:scripts' 'yarn lint:styles'", | ||
"pretest": "yarn lint", | ||
"test": "concurrently 'yarn test:jest' 'yarn test:cypress'", | ||
"test:coverage": "concurrently 'yarn test:jest --coverage' 'yarn test:cypress'", | ||
"test": "concurrently 'yarn test:vitest' 'yarn test:cypress'", | ||
"test:coverage": "concurrently 'yarn test:vitest --coverage' 'yarn test:cypress'", | ||
"test:cypress": "yarn build && cypress run", | ||
"test:cypress:open": "yarn build && cypress open", | ||
"test:jest": "jest", | ||
"test:vitest": "vitest run", | ||
"release": "standard-version", | ||
"prepare": "yarn build" | ||
}, | ||
|
@@ -36,14 +36,6 @@ | |
"prettier --write" | ||
] | ||
}, | ||
"jest": { | ||
"testEnvironmentOptions": { | ||
"url": "http://localhost" | ||
}, | ||
"testEnvironment": "jsdom", | ||
"preset": "ts-jest", | ||
"fakeTimers": {} | ||
}, | ||
"author": { | ||
"name": "Luís Rodrigues", | ||
"email": "[email protected]", | ||
|
@@ -61,18 +53,17 @@ | |
"@commitlint/cli": "17.4.4", | ||
"@commitlint/config-conventional": "17.4.4", | ||
"@pacote/eslint-config": "6.0.0", | ||
"@pacote/eslint-config-jest": "3.0.1", | ||
"@rollup/plugin-commonjs": "24.0.1", | ||
"@rollup/plugin-node-resolve": "15.0.1", | ||
"@rollup/plugin-typescript": "9.0.2", | ||
"@testing-library/cypress": "9.0.0", | ||
"@testing-library/dom": "9.0.0", | ||
"@testing-library/jest-dom": "5.16.5", | ||
"@types/delegated-events": "1.1.0", | ||
"@types/jest": "29.4.0", | ||
"@types/jquery": "3.5.16", | ||
"@typescript-eslint/eslint-plugin": "5.54.0", | ||
"@typescript-eslint/parser": "5.54.0", | ||
"@vitest/coverage-c8": "^0.29.2", | ||
"axe-core": "4.6.3", | ||
"concurrently": "7.6.0", | ||
"cssnano": "5.1.15", | ||
|
@@ -84,15 +75,12 @@ | |
"eslint-config-standard": "17.0.0", | ||
"eslint-plugin-cypress": "2.12.1", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-jest": "27.2.1", | ||
"eslint-plugin-jest-dom": "4.0.3", | ||
"eslint-plugin-n": "15.6.1", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-promise": "6.1.1", | ||
"eslint-plugin-testing-library": "5.10.2", | ||
"husky": "8.0.3", | ||
"jest": "29.4.3", | ||
"jest-environment-jsdom": "29.4.3", | ||
"jsdom": "^21.1.0", | ||
"lint-staged": "13.1.2", | ||
"pixrem": "5.0.0", | ||
"postcss": "8.4.21", | ||
|
@@ -106,9 +94,9 @@ | |
"stylelint-config-prettier": "9.0.5", | ||
"stylelint-config-standard": "30.0.1", | ||
"stylelint-prettier": "3.0.0", | ||
"ts-jest": "29.0.5", | ||
"tslib": "2.5.0", | ||
"typescript": "4.9.5" | ||
"typescript": "4.9.5", | ||
"vitest": "^0.29.2" | ||
}, | ||
"dependencies": { | ||
"@pacote/get-style": "1.1.7", | ||
|
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
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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
import { test, expect, afterEach, vi } from 'vitest' | ||
import { fireEvent } from '@testing-library/dom' | ||
import { setDocumentBody, getButton } from '../helper' | ||
import littlefoot from '../../src/littlefoot' | ||
|
||
afterEach(jest.useRealTimers) | ||
afterEach(() => { | ||
vi.useRealTimers() | ||
}) | ||
|
||
test('activateDelay can be set after initialisation', () => { | ||
jest.useFakeTimers() | ||
vi.useFakeTimers() | ||
setDocumentBody('single.html') | ||
|
||
const instance = littlefoot({ activateDelay: 0 }) | ||
instance.updateSetting('activateDelay', 200) | ||
|
||
const button = getButton('1') | ||
fireEvent.click(button) | ||
jest.advanceTimersByTime(100) | ||
vi.advanceTimersByTime(100) | ||
|
||
expect(button).toHaveClass('is-changing') | ||
|
||
jest.advanceTimersByTime(100) | ||
vi.advanceTimersByTime(100) | ||
|
||
expect(button).not.toHaveClass('is-changing') | ||
}) |
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
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import { test, expect, afterEach, vi } from 'vitest' | ||
import { fireEvent } from '@testing-library/dom' | ||
import { setDocumentBody, getButton } from '../helper' | ||
import littlefoot from '../../src/littlefoot' | ||
|
||
afterEach(jest.useRealTimers) | ||
afterEach(() => { | ||
vi.useRealTimers() | ||
}) | ||
|
||
test('dismissDelay can be set after initialisation', async () => { | ||
jest.useFakeTimers() | ||
vi.useFakeTimers() | ||
setDocumentBody('single.html') | ||
|
||
const instance = littlefoot({ activateDelay: 0, dismissDelay: 0 }) | ||
instance.updateSetting('dismissDelay', 200) | ||
|
||
const button = getButton('1') | ||
fireEvent.click(button) | ||
jest.advanceTimersByTime(100) | ||
vi.advanceTimersByTime(100) | ||
fireEvent.click(button) | ||
jest.advanceTimersByTime(100) | ||
vi.advanceTimersByTime(100) | ||
|
||
expect(button).toHaveClass('is-changing') | ||
|
||
jest.advanceTimersByTime(100) | ||
vi.advanceTimersByTime(100) | ||
|
||
expect(button).not.toHaveClass('is-changing') | ||
}) |
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
Oops, something went wrong.