Skip to content
Snippets Groups Projects
Commit 03c0feb2 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6129 OZG-6200 Add aria-live-region component

parent 978b9fd3
No related branches found
No related tags found
No related merge requests found
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AriaLiveRegionComponent } from './aria-live-region.component';
describe('AriaLiveRegionComponent', () => {
let component: AriaLiveRegionComponent;
let fixture: ComponentFixture<AriaLiveRegionComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AriaLiveRegionComponent],
}).compileComponents();
fixture = TestBed.createComponent(AriaLiveRegionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
@Component({
selector: 'ods-aria-live-region',
standalone: true,
imports: [CommonModule],
template: `<span aria-live="polite" class="sr-only" role="status">{{ text }}</span>`,
})
export class AriaLiveRegionComponent {
@Input() text: string = '';
}
import { argsToTemplate, type Meta, type StoryObj } from '@storybook/angular';
import { AriaLiveRegionComponent } from './aria-live-region.component';
const meta: Meta<AriaLiveRegionComponent> = {
title: 'Aria live region',
component: AriaLiveRegionComponent,
excludeStories: /.*Data$/,
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<AriaLiveRegionComponent>;
export const Default: Story = {
args: {
text: '',
},
render: (args) => ({
props: args,
template: `
<h2>This component is suitable for screen reader. Fill text field to make screen reader read it aloud.</h2>
<ods-aria-live-region ${argsToTemplate(args)} />
`,
}),
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment