Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 44 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
npm-debug.log*

.idea/
.sass-cache/
.ionic/
.sourcemaps/
.tmp/
.versions/
coverage/
_test-reports/
node_modules/
tmp/
temp/
hooks/
platforms/
./plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate

#Saninn
*.~lock.*
.vscode/plugins.json
dist/
dist-bundles/
dist-zips/
cypress/videos
cypress/screenshots
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
npm-debug.log*

.idea/
.sass-cache/
.ionic/
.sourcemaps/
.tmp/
.versions/
coverage/
_test-reports/
node_modules/
tmp/
temp/
hooks/
platforms/
./plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate

#Saninn
*.~lock.*
.vscode/plugins.json
dist/
dist-bundles/
dist-zips/
cypress/videos
cypress/screenshots
.specs
9 changes: 9 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"servers": {
"Context7": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "--name", "Context7-MCP", "context7-mcp"]
}
}
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

## [1.1.1] - 2026-03-28

### Fixed

- `ionRangeCypress.moveToValue()` now works with `@ionic/core >= 8.8.0`.
Ionic 8.8.x renamed shadow-DOM knob classes (`range-knob-a` →
`range-knob-handle-a`, `range-knob-b` → `range-knob-handle-b`).
The library now uses a comma-separated CSS selector to match both old
and new class names, so `@ionic/core 8.7.x` users are unaffected.
The same selector was also updated in the hydration-check tests
(`get-from-supported-selector.spec.ts`).

- TypeScript and tooling updated to support `@ionic/core >= 8.8.0`:
`typescript` upgraded from `^4.5.2` to `^5.0.0` (Ionic 8.8.x uses `const`
type parameters requiring TS5), `typedoc` to `^0.28.0`, `ts-patch` to
`^3.0.0`, and `typescript-transform-paths` to `^3.5.0`.
Internal generic constraints were relaxed from `HTMLStencilElement` to
`Element` to accommodate a type change in `HTMLIonInputElement.autocorrect`
in `@ionic/core 8.8.x`.
92 changes: 92 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Commands

```bash
# Development (starts local server + opens Cypress interactive runner)
npm run develop

# Build TypeScript to dist/
npm run build

# Type-check without emitting
npm run tsc:check

# Run tests headless
npm test

# Run tests in CI mode (no video)
npm run test-ci

# Start server + run CI tests
npm run full-test

# Lint and format checks
npx eslint .
npm run prettier:check

# Multi-version compatibility test (used in CI)
npm run ci
```

Tests require a running local server on port 3999. `npm run develop` / `npm run full-test` handle this automatically via `start-server-and-test`.

To run a single spec file, open Cypress interactively with `npm run test-open` and select the spec, or pass `--spec` to `cypress run`:

```bash
npx cypress run --spec "cypress/e2e/components/button.spec.ts"
```

## Architecture

This library exposes singleton helper instances that wrap Cypress commands to handle Ionic's Shadow DOM complexity. Consumers add `includeShadowDom: true` to their `cypress.config` and use the helpers instead of raw `cy.get()`.

### Versioning contract

- Ionic ≤ 7 → `cypress-ionic` 0.x.x
- Ionic ≥ 8 → `cypress-ionic` 1.x.x

### Source layout (`src/`)

- **`index.ts`** — re-exports all public singletons and types
- **`components/`** — one class per Ionic component, each exported as a singleton:
- `IonButtonCypress` → `ionButtonCypress`
- `IonInputCypress` → `ionInputCypress`
- `IonRangeCypress` → `ionRangeCypress`
- `IonSelectCypress` → `ionSelectCypress` (orchestrates three sub-strategies: alert, action-sheet, popover)
- **`interfaces/`** — shared TypeScript types; `SupportedSelectors<T>` is the union of `string | JQuery<T> | Cypress.Chainable<JQuery<T>>` accepted by every public method
- **`helpers/get-from-supported-selector.ts`** — normalizes any `SupportedSelectors` input to a `Cypress.Chainable` and asserts the `.hydrated` class (confirms Ionic has initialized the element)

Every public method on a component class must return `Cypress.Chainable<JQuery<ComponentElement>>` — enforced by the `CypressIonicComponentClass<T, C>` interface.

### Test setup

- `/html/index.html` + `/html/assets/scripts.mjs` — static page with real Ionic components served on port 3999 during tests
- `cypress/e2e/components/` — one spec per component
- `test-helpers/` — shared Cypress test utilities

### TypeScript path aliases (tsconfig.json)

```
@lib → ./src/index.ts
@interfaces → ./src/interfaces/index.ts
@helpers → ./src/helpers/index.ts
```

Aliases are resolved at build time by `typescript-transform-paths` (ts-patch plugin).

## Development Philosophy

- **Prefer backward-compatible changes.** When a fix can support both the current and a newer version of a dependency (e.g. via comma-separated CSS selectors, feature detection, or a simple fallback), do so rather than raising the `peerDependency` floor. Only drop support for a version when backward compatibility is genuinely impossible.

## Development Philosophy

- **Prefer backward-compatible changes.** When a fix can support both the current and a newer version of a dependency (e.g. via comma-separated CSS selectors, feature detection, or a simple fallback), do so rather than raising the `peerDependency` floor. Only drop support for a version when backward compatibility is genuinely impossible.

## Commit conventions

Commits must follow Conventional Commits (enforced by commitlint + Husky). Allowed types: `build`, `chore`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`, `release`, `wip`.

Staged files are auto-formatted by `pretty-quick` on pre-commit.
6 changes: 3 additions & 3 deletions cypress/e2e/get-from-supported-selector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Get From Supported Selector', () => {
getFromSupportedSelector<IonRange>('.ion-range-to-test-hydration')
.then(($ionRange) => {
return $ionRange[0].shadowRoot?.querySelector(
'.range-knob-handle.range-knob-a'
'.range-knob-handle-a, .range-knob-handle.range-knob-a'
);
})
.should('exist');
Expand All @@ -51,7 +51,7 @@ describe('Get From Supported Selector', () => {
getFromSupportedSelector<IonRange>(cy.get('.ion-range-to-test-hydration'))
.then(($ionRange) => {
return $ionRange[0].shadowRoot?.querySelector(
'.range-knob-handle.range-knob-a'
'.range-knob-handle-a, .range-knob-handle.range-knob-a'
);
})
.should('exist');
Expand All @@ -63,7 +63,7 @@ describe('Get From Supported Selector', () => {
getFromSupportedSelector($jQueryObject)
.then(($ionRange) => {
return $ionRange[0].shadowRoot?.querySelector(
'.range-knob-handle.range-knob-a'
'.range-knob-handle-a, .range-knob-handle.range-knob-a'
);
})
.should('exist');
Expand Down
Loading
Loading