Skip to content

Commit

Permalink
fix(abdtp-component): aot build was failing because _model is private
Browse files Browse the repository at this point in the history
remove private modifier from _model, added aot build to npm test, and optimized class imports

fixes #425
  • Loading branch information
dalelotts committed Mar 8, 2018
1 parent 936968f commit 5fb34a6
Show file tree
Hide file tree
Showing 17 changed files with 778 additions and 291 deletions.
966 changes: 731 additions & 235 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 17 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lint": "ng lint",
"ng": "ng",
"start": "ng serve",
"test": "ng lint && ng test --single-run --code-coverage && npm run build:lib ",
"test": "ng lint && ng test --single-run --code-coverage && ng build --prod && npm run build:lib ",
"test:tdd": "ng test",
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
Expand Down Expand Up @@ -52,18 +52,18 @@
"zone.js": ">=0.8.18"
},
"devDependencies": {
"@angular/animations": "^5.2.4",
"@angular/cli": "^1.6.8",
"@angular/common": "^5.2.4",
"@angular/compiler": "^5.2.4",
"@angular/compiler-cli": "^5.2.4",
"@angular/core": "^5.2.4",
"@angular/forms": "^5.2.4",
"@angular/http": "^5.2.4",
"@angular/language-service": "^5.2.4",
"@angular/platform-browser": "^5.2.4",
"@angular/platform-browser-dynamic": "^5.2.4",
"@angular/router": "^5.2.4",
"@angular/animations": "^5.2.7",
"@angular/cli": "^1.7.2",
"@angular/common": "^5.2.7",
"@angular/compiler": "^5.2.7",
"@angular/compiler-cli": "^5.2.7",
"@angular/core": "^5.2.7",
"@angular/forms": "^5.2.7",
"@angular/http": "^5.2.7",
"@angular/language-service": "^5.2.7",
"@angular/platform-browser": "^5.2.7",
"@angular/platform-browser-dynamic": "^5.2.7",
"@angular/router": "^5.2.7",
"@compodoc/compodoc": "^1.0.8",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
Expand All @@ -77,16 +77,16 @@
"karma": "^2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"moment": "^2.20.1",
"ng-packagr": "^2.1.0",
"moment": "^2.21.0",
"ng-packagr": "^2.2.0",
"open-iconic": "^1.1.1",
"protractor": "^5.3.0",
"rxjs": "^5.5.6",
"scss-bundle": "^2.1.2",
"semantic-release": "^12.4.1",
"semantic-release": "^15.0.0",
"stylelint": "^9.1.1",
"ts-node": "^5.0.1",
"tslint": "^5.9.1",
Expand All @@ -110,12 +110,6 @@
"dist"
]
}
],
"success": [
"@semantic-release/github"
],
"fail": [
"@semantic-release/github"
]
},
"dependencies": {
Expand Down
5 changes: 2 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
* found in the LICENSE file at https://github.com/dalelotts/angular-bootstrap-datetimepicker/blob/master/LICENSE
*/

import {Component, ViewChild} from '@angular/core';
import {DlDateTimePickerComponent} from '../lib/dl-date-time-picker';
import {Component} from '@angular/core';
import {DateButton} from '../lib/dl-date-time-picker';
import moment = require('moment');
import * as moment from 'moment';
import {unitOfTime} from 'moment';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class DlDateTimePickerComponent<D> implements OnChanges, OnInit, ControlV
*
* @internal
**/
private _model: DlDateTimePickerModel;
_model: DlDateTimePickerModel;

/**
* Maps view name to the next view (the view for the next smallest increment of time).
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dl-date-time-picker/dl-model-provider-day.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import {DlModelProvider} from './dl-model-provider';
import {DlDateTimePickerModel} from './dl-date-time-picker-model';
import {Component, SimpleChanges} from '@angular/core';
import {SimpleChanges} from '@angular/core';
import * as _moment from 'moment';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/lib/dl-date-time-picker/dl-model-provider-hour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

import {DlModelProvider} from './dl-model-provider';
import {DlDateTimePickerModel} from './dl-date-time-picker-model';
import {Component, SimpleChanges} from '@angular/core';
import {SimpleChanges} from '@angular/core';
import * as _moment from 'moment';

/**
* Work around for moment namespace conflict when used with webpack and rollup.
* See https://github.com/dherges/ng-packagr/issues/163
Expand Down
3 changes: 2 additions & 1 deletion src/lib/dl-date-time-picker/dl-model-provider-minute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

import {DlModelProvider} from './dl-model-provider';
import {DlDateTimePickerModel} from './dl-date-time-picker-model';
import {Component, SimpleChanges} from '@angular/core';
import {SimpleChanges} from '@angular/core';
import * as _moment from 'moment';

/**
* Work around for moment namespace conflict when used with webpack and rollup.
* See https://github.com/dherges/ng-packagr/issues/163
Expand Down
3 changes: 2 additions & 1 deletion src/lib/dl-date-time-picker/dl-model-provider-month.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

import {DlModelProvider} from './dl-model-provider';
import {DlDateTimePickerModel} from './dl-date-time-picker-model';
import {Component, SimpleChanges} from '@angular/core';
import {SimpleChanges} from '@angular/core';
import * as _moment from 'moment';

/**
* Work around for moment namespace conflict when used with webpack and rollup.
* See https://github.com/dherges/ng-packagr/issues/163
Expand Down
3 changes: 2 additions & 1 deletion src/lib/dl-date-time-picker/dl-model-provider-year.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

import {DlModelProvider} from './dl-model-provider';
import {DlDateTimePickerModel} from './dl-date-time-picker-model';
import {Component, SimpleChanges} from '@angular/core';
import {SimpleChanges} from '@angular/core';
import * as _moment from 'moment';
import {Moment} from 'moment';

/**
* Work around for moment namespace conflict when used with webpack and rollup.
* See https://github.com/dherges/ng-packagr/issues/163
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('DlDateTimePickerComponent startView=day', () => {
// I think it is related to https://github.com/angular/angular/issues/10816
const activeElement = debugElement.query(By.css('.dl-abdtp-active')).nativeElement;
activeElement.focus();
dispatchKeyboardEvent(activeElement, 'keydown', RIGHT_ARROW);
dispatchKeyboardEvent(activeElement, 'keydown', HOME);
fixture.detectChanges();

const selectedElements = fixture.debugElement.queryAll(By.css('.dl-abdtp-selected'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('DlDateTimePickerComponent startView=hour', () => {
expect(tabIndexElements.length).toBe(1);
});

it('should contain 1 .dl-abdtp-selectedelement for the current value', () => {
it('should contain 1 .dl-abdtp-selected element for the current value', () => {
component.picker.value = moment().startOf('hour').valueOf();
fixture.detectChanges();

Expand All @@ -141,7 +141,7 @@ describe('DlDateTimePickerComponent startView=hour', () => {
// I think it is related to https://github.com/angular/angular/issues/10816
const activeElement = debugElement.query(By.css('.dl-abdtp-active')).nativeElement;
activeElement.focus();
dispatchKeyboardEvent(activeElement, 'keydown', RIGHT_ARROW);
dispatchKeyboardEvent(activeElement, 'keydown', HOME);
fixture.detectChanges();

const currentElements = fixture.debugElement.queryAll(By.css('.dl-abdtp-selected'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('DlDateTimePickerComponent startView=minute', () => {
expect(currentElements[0].nativeElement.classList).toContain(currentMoment.valueOf().toString());
});

it('should contain 1 .dl-abdtp-selectedelement for the current minute', () => {
it('should contain 1 .dl-abdtp-selected element for the current minute', () => {
const currentElements = fixture.debugElement.queryAll(By.css('.dl-abdtp-active'));
expect(currentElements.length).toBe(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('DlDateTimePickerComponent startView=month', () => {
expect(currentElements[0].nativeElement.classList).toContain(moment().startOf('month').valueOf().toString());
});

it('should contain 1 .dl-abdtp-selectedelement for the current month', () => {
it('should contain 1 .dl-abdtp-selected element for the current month', () => {
component.picker.value = moment().startOf('month').valueOf();
fixture.detectChanges();

Expand All @@ -139,7 +139,7 @@ describe('DlDateTimePickerComponent startView=month', () => {
// I think it is related to https://github.com/angular/angular/issues/10816
const activeElement = debugElement.query(By.css('.dl-abdtp-active')).nativeElement;
activeElement.focus();
dispatchKeyboardEvent(activeElement, 'keydown', RIGHT_ARROW);
dispatchKeyboardEvent(activeElement, 'keydown', HOME);
fixture.detectChanges();

const selectedElements = fixture.debugElement.queryAll(By.css('.dl-abdtp-selected'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('DlDateTimePickerComponent', () => {
expect(activeElements[0].nativeElement.classList).toContain(moment().startOf('year').valueOf().toString());
});

it('should contain 1 .dl-abdtp-selectedelement for the current year', () => {
it('should contain 1 .dl-abdtp-selected element for the current year', () => {
component.picker.value = moment().startOf('year').valueOf();
fixture.detectChanges();

Expand All @@ -146,7 +146,7 @@ describe('DlDateTimePickerComponent', () => {
// I think it is related to https://github.com/angular/angular/issues/10816
const activeElement = debugElement.query(By.css('.dl-abdtp-active')).nativeElement;
activeElement.focus();
dispatchKeyboardEvent(activeElement, 'keydown', RIGHT_ARROW);
dispatchKeyboardEvent(activeElement, 'keydown', HOME);
fixture.detectChanges();

const selectedElements = fixture.debugElement.queryAll(By.css('.dl-abdtp-selected'));
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* found in the LICENSE file at https://github.com/dalelotts/angular-bootstrap-datetimepicker/blob/master/LICENSE
*/

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import {AppModule} from './app/app.module';
import {environment} from './environments/environment';

if (environment.production) {
enableProdMode();
Expand Down
11 changes: 4 additions & 7 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.


/**
Expand All @@ -54,13 +58,6 @@ import 'core-js/es7/reflect';



/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.



/***************************************************************************************************
* APPLICATION IMPORTS
*/
Expand Down
7 changes: 2 additions & 5 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
import {getTestBed} from '@angular/core/testing';
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';

// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const __karma__: any;
Expand Down

0 comments on commit 5fb34a6

Please sign in to comment.