Skip to content

Commit

Permalink
fix(tests): fix failing test for buttons and accordion
Browse files Browse the repository at this point in the history
Conflicts:
	components/buttons/button.directive.spec.ts
  • Loading branch information
Oleksandr Telnov committed Jun 24, 2016
1 parent 5c8fcf1 commit 8ea9c10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 11 additions & 9 deletions components/buttons/button.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {Component} from '@angular/core';
import {it, beforeEach, beforeEachProviders, injectAsync, expect} from '@angular/core/testing';
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import {ButtonCheckboxDirective} from './button-checkbox.directive';
import {ButtonRadioDirective} from './button-radio.directive';
// import {ButtonCheckboxDirective} from './button-checkbox.directive';
// import {ButtonRadioDirective} from './button-radio.directive';
import {BUTTON_DIRECTIVES} from '../buttons';
import {NgModel} from '@angular/common';

const html = `
<div>
Expand Down Expand Up @@ -150,14 +152,14 @@ describe('Directive: Buttons', () => {
delete context.radioModel;
expect(context.radioModel).toBeUndefined();

btn.children[2].click();
(btn.children[2] as HTMLElement).click();
fixture.detectChanges();
expect(context.radioModel).toEqual('Right');
expect(btn.children[0]).not.toHaveCssClass('active');
expect(btn.children[1]).not.toHaveCssClass('active');
expect(btn.children[2]).toHaveCssClass('active');

btn.children[1].click();
(btn.children[1] as HTMLElement).click();
fixture.detectChanges();
expect(context.radioModel).toEqual('Middle');
expect(btn.children[0]).not.toHaveCssClass('active');
Expand All @@ -172,7 +174,7 @@ describe('Directive: Buttons', () => {
expect(btn.children[1]).toHaveCssClass('active');
expect(btn.children[2]).not.toHaveCssClass('active');

btn.children[1].click();
(btn.children[1] as HTMLElement).click();
fixture.detectChanges();
expect(context.radioModel).toEqual('Middle');
expect(btn.children[0]).not.toHaveCssClass('active');
Expand All @@ -191,7 +193,7 @@ describe('Directive: Buttons', () => {
expect(btn.children[1]).toHaveCssClass('active');
expect(btn.children[3]).not.toHaveCssClass('active');

btn.children[3].click();
(btn.children[3] as HTMLElement).click();
fixture.detectChanges();
expect(btn.children[1]).toHaveCssClass('active');
expect(btn.children[3]).not.toHaveCssClass('active');
Expand All @@ -201,14 +203,14 @@ describe('Directive: Buttons', () => {
let btn = element.querySelector('.btn-group.radioUncheckable');
expect(context.radioUncheckableModel).toBeUndefined();

btn.children[0].click();
(btn.children[0] as HTMLElement).click();
fixture.detectChanges();
expect(context.radioUncheckableModel).toEqual('Left');
expect(btn.children[0]).toHaveCssClass('active');
expect(btn.children[1]).not.toHaveCssClass('active');
expect(btn.children[2]).not.toHaveCssClass('active');

btn.children[0].click();
(btn.children[0] as HTMLElement).click();
fixture.detectChanges();
expect(context.radioUncheckableModel).toBeNull();
expect(btn.children[0]).not.toHaveCssClass('active');
Expand All @@ -220,7 +222,7 @@ describe('Directive: Buttons', () => {

@Component({
selector: 'buttons-test',
directives: [ButtonCheckboxDirective, ButtonRadioDirective],
directives: [BUTTON_DIRECTIVES, NgModel],
template: ''
})

Expand Down
4 changes: 2 additions & 2 deletions components/tabs/tabset.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const html = `
</tabset>
`;

function getTabTitles(nativeEl:HTMLElement):NodeList {
function getTabTitles(nativeEl:HTMLElement):NodeListOf<Element> {
return nativeEl.querySelectorAll('.nav-link');
}

function getTabContent(nativeEl:HTMLElement):NodeList {
function getTabContent(nativeEl:HTMLElement):NodeListOf<Element> {
return nativeEl.querySelectorAll('.tab-content .tab-pane');
}

Expand Down

0 comments on commit 8ea9c10

Please sign in to comment.