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
1 change: 1 addition & 0 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "angular/**"
pull_request:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and Publish (Reusable)

on:
workflow_call:
inputs:
publish-script:
description: 'The npm script to run for publishing (e.g., "publish" or "publish:beta")'
required: true
type: string
secrets:
NPM_TOKEN:
description: 'NPM authentication token'
required: true

permissions:
contents: write
pull-requests: write

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: "https://registry.npmjs.org"

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install
run: pnpm install

- name: Build
run: pnpm run build

- name: Publish to npm
run: pnpm run ${{ inputs.publish-script }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "core/**"
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "react/**"
pull_request:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Beta Pre-release

on:
push:
branches:
- beta

permissions:
contents: write
pull-requests: write

jobs:
release-beta:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: googleapis/release-please-action@v4
id: release
with:
target-branch: beta
config-file: release-please-config.beta.json
manifest-file: .release-please-manifest.beta.json
versioning-strategy: prerelease

publish:
needs: release-beta
if: ${{ fromJSON(needs.release-beta.outputs.releases_created) }}
uses: ./.github/workflows/build-and-publish.yml
with:
publish-script: "publish:beta"
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53 changes: 12 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,17 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- uses: google-github-actions/release-please-action@v4
- uses: googleapis/release-please-action@v4
id: release
- name: Checkout
uses: actions/checkout@v4
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: "https://registry.npmjs.org"
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Install
run: pnpm install
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Build
run: pnpm run build
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- name: Install (again - testing...)
run: pnpm install
if: ${{ fromJSON(steps.release.outputs.releases_created) }}
- run: pnpm run publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ fromJSON(steps.release.outputs.releases_created) }}

publish:
needs: release
if: ${{ fromJSON(needs.release.outputs.releases_created) }}
uses: ./.github/workflows/build-and-publish.yml
with:
publish-script: "publish"
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- beta
paths:
- "tokens/**"
pull_request:
Expand Down
10 changes: 5 additions & 5 deletions .release-please-manifest.beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tokens": "13.3.0",
"core": "13.3.0",
"angular/projects/catalyst": "13.3.0",
"angular/projects/catalyst-formly": "13.3.0",
"react": "13.3.0"
"tokens": "13.4.0-beta",
"core": "13.4.0-beta",
"angular/projects/catalyst": "13.4.0-beta",
"angular/projects/catalyst-formly": "13.4.0-beta",
"react": "13.4.0-beta"
}
8 changes: 8 additions & 0 deletions angular/projects/catalyst-formly/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [13.4.0-beta](https://github.com/haiilo/catalyst/compare/catalyst-angular-formly-v13.3.0...catalyst-angular-formly-v13.4.0-beta) (2025-10-29)


### Features

* test beta prerelease configuration ([4365ad6](https://github.com/haiilo/catalyst/commit/4365ad646bb72f5e1c0245f969c0dddb7765fea3))
* test beta prerelease configuration ([0a4ade7](https://github.com/haiilo/catalyst/commit/0a4ade791508bf53e9313d109279237831dfd74e))

## [13.3.0](https://github.com/haiilo/catalyst/compare/catalyst-angular-formly-v13.2.0...catalyst-angular-formly-v13.3.0) (2025-10-22)


Expand Down
2 changes: 1 addition & 1 deletion angular/projects/catalyst-formly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haiilo/catalyst-angular-formly",
"version": "13.3.0",
"version": "13.4.0-beta",
"description": "Angular Formly bindings for Catalyst Design System",
"license": "MIT",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions angular/projects/catalyst/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [13.4.0-beta](https://github.com/haiilo/catalyst/compare/catalyst-angular-v13.3.0...catalyst-angular-v13.4.0-beta) (2025-10-29)


### Features

* test beta prerelease configuration ([4365ad6](https://github.com/haiilo/catalyst/commit/4365ad646bb72f5e1c0245f969c0dddb7765fea3))
* test beta prerelease configuration ([0a4ade7](https://github.com/haiilo/catalyst/commit/0a4ade791508bf53e9313d109279237831dfd74e))

## [13.3.0](https://github.com/haiilo/catalyst/compare/catalyst-angular-v13.2.0...catalyst-angular-v13.3.0) (2025-10-22)


Expand Down
2 changes: 1 addition & 1 deletion angular/projects/catalyst/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haiilo/catalyst-angular",
"version": "13.3.0",
"version": "13.4.0-beta",
"description": "Angular wrapper for Catalyst Design System",
"license": "MIT",
"scripts": {
Expand Down
13 changes: 13 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [13.4.0-beta](https://github.com/haiilo/catalyst/compare/catalyst-core-v13.3.0...catalyst-core-v13.4.0-beta) (2025-10-29)


### Features

* test beta prerelease configuration ([4365ad6](https://github.com/haiilo/catalyst/commit/4365ad646bb72f5e1c0245f969c0dddb7765fea3))
* test beta prerelease configuration ([0a4ade7](https://github.com/haiilo/catalyst/commit/0a4ade791508bf53e9313d109279237831dfd74e))


### Bug Fixes

* **core:** prevent catChange event emission on select initialization ([#807](https://github.com/haiilo/catalyst/issues/807)) ([083eee3](https://github.com/haiilo/catalyst/commit/083eee368baf86edb31c596876b77a4ca5cd71f9))

## [13.3.0](https://github.com/haiilo/catalyst/compare/catalyst-core-v13.2.0...catalyst-core-v13.3.0) (2025-10-22)


Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haiilo/catalyst",
"version": "13.3.0",
"version": "13.4.0-beta",
"description": "Catalyst Design System",
"license": "MIT",
"repository": {
Expand Down
30 changes: 30 additions & 0 deletions core/src/components/cat-select/cat-select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,34 @@ describe('cat-select', () => {
const element = await page.find('cat-select');
expect(element).toHaveClass('hydrated');
});

it('should not emit catChange event on initialization with value', async () => {
const page = await newE2EPage();
await page.setContent(`
<cat-select label="Label" value="option1"></cat-select>
<script type="module">
const select = document.querySelector('cat-select');
const connector = {
resolve: ids => Promise.resolve([{ id: 'option1', label: 'Option 1' }].filter(item => ids.includes(item.id))),
retrieve: () => Promise.resolve({
content: [
{ id: 'option1', label: 'Option 1' },
{ id: 'option2', label: 'Option 2' },
{ id: 'option3', label: 'Option 3' }
],
last: true
}),
render: item => ({ label: item.label })
};
select.connect(connector);
</script>
`);

const select = await page.find('cat-select');
const changeSpy = await select.spyOnEvent('catChange');

await page.waitForChanges();

expect(changeSpy).not.toHaveReceivedEvent();
});
});
67 changes: 67 additions & 0 deletions core/src/components/cat-select/cat-select.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ jest.mock('../cat-i18n/cat-i18n-registry');

import { newSpecPage } from '@stencil/core/testing';
import { CatSelect } from './cat-select';
import { stringArrayConnector } from './connectors';

describe('cat-select', () => {
it('renders', async () => {
Expand All @@ -13,4 +14,70 @@ describe('cat-select', () => {
<cat-select label="Label" tabindex="0"></cat-select>
`);
});

describe('catChange', () => {
it('should not emit catChange event on initialization with value', async () => {
const page = await newSpecPage({
components: [CatSelect],
html: `<cat-select label="Label" value="option1"></cat-select>`
});

const select = page.rootInstance as CatSelect;
const catChangeSpy = jest.fn();

page.root?.addEventListener('catChange', catChangeSpy);

await select.connect(stringArrayConnector(['option1', 'option2', 'option3']));
await page.waitForChanges();

expect(catChangeSpy).not.toHaveBeenCalled();
});

it('should emit catChange event when selection state changes from user interaction', async () => {
const page = await newSpecPage({
components: [CatSelect],
html: `<cat-select label="Label"></cat-select>`
});

const select = page.rootInstance as CatSelect;
let eventEmitted = false;

await select.connect(stringArrayConnector(['option1', 'option2', 'option3']));
await page.waitForChanges();

page.root?.addEventListener('catChange', () => {
eventEmitted = true;
});

// Directly update selection state (simulating what happens after user interaction)
// This mimics the internal flow when user clicks an option
select['patchState']({
selection: [{ item: { id: 'option1' }, render: { label: 'option1' } }],
tempSelection: []
});
await page.waitForChanges();

expect(eventEmitted).toBe(true);
});

it('should not emit catChange event when value is changed programmatically', async () => {
const page = await newSpecPage({
components: [CatSelect],
html: `<cat-select label="Label"></cat-select>`
});

const select = page.rootInstance as CatSelect;
const catChangeSpy = jest.fn();

await select.connect(stringArrayConnector(['option1', 'option2', 'option3']));
await page.waitForChanges();

page.root?.addEventListener('catChange', catChangeSpy);

select.value = 'option2';
await page.waitForChanges();

expect(catChangeSpy).not.toHaveBeenCalled();
});
});
});
2 changes: 1 addition & 1 deletion core/src/components/cat-select/cat-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ export class CatSelect {
if (!oldState.isResolving) {
this.valueChangedBySelection = true;
this.value = newValue;
this.catChange.emit();
}
this.catChange.emit();
this.showErrorsIfTimeout();
}
}
Expand Down
Loading