Skip to content

Commit f841352

Browse files
wesleychoFoxandxss
authored andcommitted
feat(angular): upgrade to rc4
- Upgrade angular to rc4
1 parent 146ec1b commit f841352

27 files changed

+66
-110
lines changed

demo/src/app/app.routes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from './components';
2020

2121
const routes: RouterConfig = [
22-
{path: '', redirectTo: 'home'},
22+
{path: '', pathMatch: 'full', redirectTo: 'home'},
2323
{path: 'home', component: DefaultComponent},
2424
{path: 'getting-started', component: GettingStarted},
2525
{path: 'components', redirectTo: 'components/accordion'},

demo/src/app/components/shared/api-docs/api-docs.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const docs = require('../../../../docs.json');
44

55
@Component({
66
selector: 'ngbd-api-docs',
7-
changeDetection: ChangeDetectionStrategy.CheckOnce,
7+
changeDetection: ChangeDetectionStrategy.OnPush,
88
template: `
99
<h2><a href="https://github.com/ng-bootstrap/core/tree/master/{{apiDocs.fileName}}" target="_blank">{{apiDocs.className}}</a></h2>
1010
<p>{{apiDocs.description}}</p>

demo/src/main.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { enableProdMode } from '@angular/core';
22
import { bootstrap } from '@angular/platform-browser-dynamic';
3-
import { ELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser';
43
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
54

65
import { APP_ROUTER_PROVIDERS } from './app/app.routes';
@@ -11,8 +10,6 @@ const ENV_PROVIDERS = [];
1110
// depending on the env mode, enable prod mode or add debugging modules
1211
if (process.env.ENV === 'build') {
1312
enableProdMode();
14-
} else {
15-
ENV_PROVIDERS.push(ELEMENT_PROBE_PROVIDERS);
1613
}
1714

1815
bootstrap(AppComponent, [

karma-test-shim.js

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Promise.all([System.import('@angular/core/testing'), System.import('@angular/pla
3131
testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
3232
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
3333
})
34+
.then(function() { return Promise.all(customMatchers()); })
3435
.then(function() { return Promise.all(resolveTestFiles()); })
3536
.then(function() { __karma__.start(); }, function(error) { __karma__.error(error.stack || error); });
3637

@@ -45,6 +46,10 @@ function createPathRecords(pathsMapping, appPath) {
4546
return pathsMapping;
4647
}
4748

49+
function customMatchers() {
50+
return System.import('/base/temp/util/matchers.js');
51+
}
52+
4853
function onlyAppFiles(filePath) {
4954
return /\/base\/temp\/(?!.*\.spec\.js$).*\.js$/.test(filePath);
5055
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
},
2020
"homepage": "https://github.com/ng-bootstrap/core#readme",
2121
"devDependencies": {
22-
"@angular/common": "2.0.0-rc.3",
23-
"@angular/compiler": "2.0.0-rc.3",
24-
"@angular/core": "2.0.0-rc.3",
25-
"@angular/platform-browser": "2.0.0-rc.3",
26-
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
27-
"@angular/router": "3.0.0-alpha.8",
22+
"@angular/common": "2.0.0-rc.4",
23+
"@angular/compiler": "2.0.0-rc.4",
24+
"@angular/core": "2.0.0-rc.4",
25+
"@angular/platform-browser": "2.0.0-rc.4",
26+
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
27+
"@angular/router": "3.0.0-beta.1",
2828
"autoprefixer": "^6.3.6",
2929
"bootstrap": "^4.0.0-alpha.2",
3030
"clang-format": "1.0.35",

src/accordion/accordion.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async, beforeEachProviders} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

src/accordion/panel.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async, beforeEachProviders} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

@@ -27,7 +27,6 @@ function expectToBeEnabled(panelEl) {
2727
}
2828

2929
describe('ngb-panel', () => {
30-
3130
it('should render as a closed, enabled panel by default', async(inject([TestComponentBuilder], (tcb) => {
3231
const panelHtml = `
3332
<ngb-panel title="Test title">Test content</ngb-panel>

src/alert/alert.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async} from '@angular/core/testing';
1+
import {inject, async} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

@@ -15,7 +15,6 @@ function getCloseButton(element: HTMLElement): HTMLButtonElement {
1515
}
1616

1717
describe('ngb-alert', () => {
18-
1918
it('should have type warning and by dismissible by default', async(inject([TestComponentBuilder], (tcb) => {
2019
tcb.overrideTemplate(TestComponent, '<ngb-alert>Watch out!</ngb-alert>')
2120
.createAsync(TestComponent)

src/buttons/radio.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {it, iit, expect, inject, async, describe, ddescribe} from '@angular/core/testing';
1+
import {inject, async} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33
import {Component} from '@angular/core';
4+
45
import {NGB_RADIO_DIRECTIVES} from './radio';
56

67

@@ -24,7 +25,6 @@ function getInput(nativeEl: HTMLElement, idx: number): HTMLInputElement {
2425
}
2526

2627
describe('ngbRadioGroup', () => {
27-
2828
const defaultHtml = `<div [(ngModel)]="model" ngbRadioGroup>
2929
<label class="btn">
3030
<input type="radio" name="radio" [value]="values[0]"/> {{ values[0] }}

src/carousel/carousel.spec.ts

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
7-
inject,
8-
fakeAsync,
9-
discardPeriodicTasks,
10-
tick,
11-
beforeEach,
12-
beforeEachProviders
13-
} from '@angular/core/testing';
1+
import {inject, fakeAsync, discardPeriodicTasks, tick, addProviders} from '@angular/core/testing';
142
import {TestComponentBuilder} from '@angular/compiler/testing';
153

164
import {By} from '@angular/platform-browser';
@@ -37,7 +25,6 @@ function expectActiveSlides(nativeEl: HTMLDivElement, active: boolean[]) {
3725
}
3826

3927
describe('ngb-carousel', () => {
40-
4128
it('should render slides and navigation indicators', fakeAsync(inject([TestComponentBuilder], (tcb) => {
4229
const html = `
4330
<ngb-carousel>
@@ -51,8 +38,8 @@ describe('ngb-carousel', () => {
5138

5239
const slideElms = fixture.nativeElement.querySelectorAll('.carousel-item');
5340
expect(slideElms.length).toBe(2);
54-
expect(slideElms[0].textContent).toMatchPattern(/foo/);
55-
expect(slideElms[1].textContent).toMatchPattern(/bar/);
41+
expect(slideElms[0].textContent).toMatch(/foo/);
42+
expect(slideElms[1].textContent).toMatch(/bar/);
5643

5744
expect(fixture.nativeElement.querySelectorAll('ol.carousel-indicators > li').length).toBe(2);
5845

src/collapse/collapse.spec.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
72
inject,
83
async,
94
} from '@angular/core/testing';
@@ -19,7 +14,6 @@ function getCollapsibleContent(element: HTMLElement): HTMLDivElement {
1914
}
2015

2116
describe('ngb-collapse', () => {
22-
2317
let html = `<div [ngbCollapse]="collapsed">Some content</div>`;
2418

2519
it('should have content open and aria-expanded true', async(inject([TestComponentBuilder], (tcb) => {

src/dropdown/dropdown.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async, beforeEachProviders} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

@@ -114,7 +114,6 @@ describe('ngb-dropdown', () => {
114114
});
115115

116116
describe('ngb-dropdown-toggle', () => {
117-
118117
it('should toggle dropdown on click', async(inject([TestComponentBuilder], (tcb) => {
119118
const html = `
120119
<div ngbDropdown>

src/modal/modal_backdrop.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async, beforeEachProviders} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33

44
import {NgbModalBackdrop} from './modal_backdrop';
55

66
describe('ngb-modal-backdrop', () => {
7-
87
it('should render backdrop with required CSS classes', async(inject([TestComponentBuilder], (tcb) => {
98
tcb.createAsync(NgbModalBackdrop).then((fixture) => {
109
fixture.detectChanges();

src/modal/modal_window.spec.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
7-
inject,
8-
async,
9-
beforeEach,
10-
beforeEachProviders
11-
} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
122
import {TestComponentBuilder} from '@angular/compiler/testing';
133

144
import {NgbModalWindow} from './modal_window';
155
import {ModalDismissReasons} from './modal_dismiss_reasons';
166

177
describe('ngb-modal-dialog', () => {
18-
198
describe('basic rendering functionality', () => {
209

2110
it('should render default modal window', async(inject([TestComponentBuilder], (tcb) => {

src/pager/pager.spec.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
7-
inject,
8-
async,
9-
beforeEach,
10-
beforeEachProviders
11-
} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
122

133
import {TestComponentBuilder} from '@angular/compiler/testing';
144

@@ -37,7 +27,6 @@ function getLink(nativeEl: HTMLElement, idx: number): HTMLAnchorElement {
3727
}
3828

3929
describe('ngb-pagination', () => {
40-
4130
describe('business logic', () => {
4231

4332
let pager: NgbPager;

src/pagination/pagination.spec.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
7-
inject,
8-
async,
9-
beforeEach,
10-
beforeEachProviders
11-
} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
122

133
import {TestComponentBuilder} from '@angular/compiler/testing';
144

@@ -54,7 +44,6 @@ function normalizeText(txt: string): string {
5444
}
5545

5646
describe('ngb-pagination', () => {
57-
5847
describe('business logic', () => {
5948

6049
let pagination: NgbPagination;

src/popover/popover.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async} from '@angular/core/testing';
1+
import {inject, async} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33

44
import {NgbPopoverWindow} from './popover';
55

66
describe('ngb-popover-window', () => {
7-
87
it('should render popover on top by default', async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
98
tcb.createAsync(NgbPopoverWindow).then((fixture) => {
109
fixture.componentInstance.title = 'Test title';

src/progressbar/progressbar.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async} from '@angular/core/testing';
1+
import {inject, async} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

@@ -15,7 +15,6 @@ function getProgressbar(nativeEl: Element): Element {
1515
}
1616

1717
describe('ng-progressbar', () => {
18-
1918
describe('business logic', () => {
2019
let progressCmp: NgbProgressbar;
2120

src/rating/rating.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async, beforeEachProviders} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
22

33
import {TestComponentBuilder} from '@angular/compiler/testing';
44

src/tabset/tabset.spec.ts

+8-19
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
import {
2-
iit,
3-
it,
4-
ddescribe,
5-
describe,
6-
expect,
7-
inject,
8-
async,
9-
beforeEach,
10-
beforeEachProviders
11-
} from '@angular/core/testing';
1+
import {inject, async, addProviders} from '@angular/core/testing';
122

133
import {TestComponentBuilder} from '@angular/compiler/testing';
144

@@ -59,7 +49,6 @@ function getButton(nativeEl: HTMLElement) {
5949
}
6050

6151
describe('ngb-tabset', () => {
62-
6352
it('should render tabs and select first tab as active by default', async(inject([TestComponentBuilder], (tcb) => {
6453
const html = `
6554
<ngb-tabset>
@@ -74,10 +63,10 @@ describe('ngb-tabset', () => {
7463
const tabTitles = getTabTitles(fixture.nativeElement);
7564
const tabContent = getTabContent(fixture.nativeElement);
7665

77-
expect(tabTitles[0].textContent).toMatchPattern(/foo/);
78-
expect(tabTitles[1].textContent).toMatchPattern(/bar/);
79-
expect(tabContent[0].textContent).toMatchPattern(/Foo/);
80-
expect(tabContent[1].textContent).toMatchPattern(/Bar/);
66+
expect(tabTitles[0].textContent).toMatch(/foo/);
67+
expect(tabTitles[1].textContent).toMatch(/bar/);
68+
expect(tabContent[0].textContent).toMatch(/Foo/);
69+
expect(tabContent[1].textContent).toMatch(/Bar/);
8170

8271
expectTabs(fixture.nativeElement, [true, false]);
8372
});
@@ -103,9 +92,9 @@ describe('ngb-tabset', () => {
10392

10493
const tabTitles = getTabTitles(fixture.nativeElement);
10594

106-
expect(tabTitles[0].textContent).toMatchPattern(/foo/);
107-
expect(tabTitles[1].innerHTML).toMatchPattern(/<b>bar<\/b>/);
108-
expect(tabTitles[2].textContent).toMatchPattern(/bazbaz/);
95+
expect(tabTitles[0].textContent).toMatch(/foo/);
96+
expect(tabTitles[1].innerHTML).toMatch(/<b>bar<\/b>/);
97+
expect(tabTitles[2].textContent).toMatch(/bazbaz/);
10998
});
11099
})));
111100

src/tooltip/tooltip.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {iit, it, ddescribe, describe, expect, inject, async} from '@angular/core/testing';
1+
import {inject, async} from '@angular/core/testing';
22
import {TestComponentBuilder} from '@angular/compiler/testing';
33

44
import {NgbTooltipWindow} from './tooltip';
55

66
describe('ngb-tooltip-window', () => {
7-
87
it('should render tooltip on top by default', async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
98
tcb.createAsync(NgbTooltipWindow).then((fixture) => {
109
fixture.detectChanges();

src/util/matchers.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
2+
3+
beforeEach(() => {
4+
jasmine.addMatchers({
5+
toHaveCssClass: function (util, customEqualityTests) {
6+
return { compare: buildError(false), negativeCompare: buildError(true) };
7+
8+
function buildError(isNot: any /** TODO #???? */) {
9+
return function (actual: any /** TODO #???? */, className: any /** TODO #???? */) {
10+
return {
11+
pass: getDOM().hasClass(actual, className) === !isNot,
12+
get message() {
13+
return `Expected ${actual.outerHTML} ${isNot ? 'not ' : ''}to contain the CSS class "${className}"`;
14+
}
15+
};
16+
};
17+
}
18+
}
19+
});
20+
});

src/util/positioning.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {it, describe, expect, beforeEach, afterEach} from '@angular/core/testing';
2-
31
import {Positioning} from './positioning';
42

53
describe('Positioning', () => {

0 commit comments

Comments
 (0)