Skip to content

Commit

Permalink
fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crisnicandrei committed Apr 23, 2024
1 parent 3424ec6 commit c7cb23f
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Shallow } from 'shallow-render';
import { ComponentsModule } from '../../components.module';
import { CheckboxComponent } from './checkbox.component';

describe('ToggleComponent', () => {
describe('CheckboxCompoent', () => {
let shallow: Shallow<CheckboxComponent>;

beforeEach(async () => {
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('ToggleComponent', () => {

it('should be focusable and have correct ARIA attributes', async () => {
const { find } = await shallow.render();
const checkboxContainer = find('.checkbox-container').nativeElement;
const checkboxContainer = find('.checkbox').nativeElement;

expect(checkboxContainer.getAttribute('role')).toEqual('checkbox');
expect(checkboxContainer.getAttribute('tabindex')).toEqual('0');
Expand Down Expand Up @@ -136,21 +136,11 @@ describe('ToggleComponent', () => {
bind: { disabled: true },
});
fixture.detectChanges();
const checkboxContainer = find('.checkbox-container').nativeElement;
const checkboxContainer = find('.checkbox').nativeElement;

expect(checkboxContainer.getAttribute('aria-disabled')).toEqual('true');
});

it('should be focusable and have correct ARIA attributes', async () => {
const { find } = await shallow.render();
const checkboxContainer = find('.checkbox-container').nativeElement;

expect(checkboxContainer.getAttribute('role')).toEqual('checkbox');
expect(checkboxContainer.getAttribute('tabindex')).toEqual('0');
expect(checkboxContainer.getAttribute('aria-checked')).toEqual('false');
expect(checkboxContainer.getAttribute('aria-disabled')).toEqual('false');
});

it('should toggle checked state on Enter key press', async () => {
const { find, instance, fixture } = await shallow.render();
instance.isChecked = false;
Expand Down Expand Up @@ -193,7 +183,7 @@ describe('ToggleComponent', () => {
bind: { disabled: true },
});
fixture.detectChanges();
const checkboxContainer = find('.checkbox-container').nativeElement;
const checkboxContainer = find('.checkbox').nativeElement;

expect(checkboxContainer.getAttribute('aria-disabled')).toEqual('true');
});
Expand Down

0 comments on commit c7cb23f

Please sign in to comment.