Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0f5c80b
Add a test demonstrating how you can use extends to directly manage s…
paulvisciano Nov 23, 2025
167cdb2
Extend Tests for @Method decorator inheritance, super() calls, method…
paulvisciano Nov 23, 2025
fff4752
Extend Tests for @Prop and @State inheritance from base classes.
paulvisciano Nov 23, 2025
d51360f
Extend Tests for extending Stencil-decorated classes with render() me…
paulvisciano Nov 23, 2025
5dae4f9
Demonstrates base classes triggering host component updates via reque…
paulvisciano Nov 24, 2025
874a3c7
Tests demonstrating lifecycle hooks living on the base class
paulvisciano Nov 24, 2025
233ed45
Tests for multi-level lifecycle inheritance
paulvisciano Nov 24, 2025
4515029
Tests for ReactiveControllerHost pattern - composition based controll…
paulvisciano Nov 24, 2025
c0a28ea
Run prettier
paulvisciano Nov 28, 2025
735b16b
Tests for decorator conflicts - duplicate decorator names of the same…
OS-paulvisciano Dec 8, 2025
5c41182
Tests for event handling inheritance - @Listen decorator inheritance
OS-paulvisciano Dec 8, 2025
7137e20
Tests for @Watch decorator inheritance
OS-paulvisciano Dec 8, 2025
c1ee67d
Tests for mixed decorator types - different decorator types with same…
OS-paulvisciano Dec 8, 2025
b2649ad
Tests for inheritance-based scaling with multiple components and cont…
OS-paulvisciano Dec 8, 2025
7ac8df4
Tests for composition-based scaling with multiple components and cont…
OS-paulvisciano Dec 8, 2025
ae4e6e6
Apply prettier formatting & tweak test case #s
OS-paulvisciano Dec 8, 2025
4151756
Merge branch 'main' of github.com-personal:paulvisciano/stencil-core …
paulvisciano Dec 8, 2025
2635e2a
Remove the duplicate method as it was causing types error
paulvisciano Dec 8, 2025
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
556 changes: 556 additions & 0 deletions test/wdio/ts-target/components.d.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { Component, h, State, Element, Event, EventEmitter } from '@stencil/core';
import { ReactiveControllerHost } from './reactive-controller-host.js';
import { ValidationController } from './validation-controller.js';
import { FocusController } from './focus-controller.js';

@Component({
tag: 'composition-checkbox-group',
})
export class CheckboxGroupCmp extends ReactiveControllerHost {
@Element() el!: HTMLElement;
@State() values: string[] = [];
@State() helperText: string = 'Select at least one option';

@Event() valueChange!: EventEmitter<string[]>;

// Controllers via composition
private validation = new ValidationController(this);
private focus = new FocusController(this);

private inputId = `checkbox-group-${Math.random().toString(36).substr(2, 9)}`;
private helperTextId = `${this.inputId}-helper-text`;
private errorTextId = `${this.inputId}-error-text`;

componentWillLoad() {
super.componentWillLoad(); // Call base class to trigger controllers
// Set up validation callback
this.validation.setValidationCallback((vals: string[]) => {
if (!vals || vals.length === 0) {
return 'Please select at least one option';
}
return undefined;
});
}

componentDidLoad() {
super.componentDidLoad(); // Call base class to trigger controllers
}

disconnectedCallback() {
super.disconnectedCallback(); // Call base class to trigger controllers
}

private handleChange = (e: Event) => {
const checkbox = e.target as HTMLInputElement;
const value = checkbox.value;

if (checkbox.checked) {
this.values = [...this.values, value];
} else {
this.values = this.values.filter((v) => v !== value);
}

this.valueChange.emit(this.values);
this.validation.validate(this.values);
};

private handleFocus = () => {
this.focus.handleFocus();
};

private handleBlur = () => {
this.focus.handleBlur();
this.validation.handleBlur(this.values);
};

render() {
const focusState = this.focus.getFocusState();
const validationData = this.validation.getValidationMessageData(this.helperTextId, this.errorTextId);

return (
<div class="checkbox-group-container">
<label>Select Options</label>
<div class="checkbox-group" tabindex="0" onFocus={this.handleFocus} onBlur={this.handleBlur}>
<label>
<input
type="checkbox"
name={this.inputId}
value="option1"
checked={this.values.includes('option1')}
onChange={this.handleChange}
/>
Option 1
</label>
<label>
<input
type="checkbox"
name={this.inputId}
value="option2"
checked={this.values.includes('option2')}
onChange={this.handleChange}
/>
Option 2
</label>
<label>
<input
type="checkbox"
name={this.inputId}
value="option3"
checked={this.values.includes('option3')}
onChange={this.handleChange}
/>
Option 3
</label>
</div>
{validationData.hasError && (
<div class="validation-message">
<div id={validationData.errorTextId} class="error-text">
{validationData.errorMessage}
</div>
</div>
)}
<div class="focus-info">
Focused: {focusState.isFocused ? 'Yes' : 'No'} | Focus Count: {focusState.focusCount} | Blur Count:{' '}
{focusState.blurCount}
</div>
</div>
);
}
}
Loading
Loading