Repository: nifi-fds Updated Branches: refs/heads/master 4eee1d776 -> c85638d8f
http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/dialogs/services/dialog.service.js ---------------------------------------------------------------------- diff --git a/src/platform/core/dialogs/services/dialog.service.js b/src/platform/core/dialogs/services/dialog.service.js new file mode 100644 index 0000000..985baf5 --- /dev/null +++ b/src/platform/core/dialogs/services/dialog.service.js @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ngCore = require('@angular/core'); +var ngMaterial = require('@angular/material'); +var FdsConfirmDialogComponent = require('@fluid-design-system/confirm-dialog-component'); + +function IDialogConfig() { + this.title = ''; + this.message = ''; + this.dialogRef = undefined; + this.viewContainerRef = undefined; + this.disableClose = true; +} + +IDialogConfig.prototype = { + contstructor: IDialogConfig +} + +$.extend(IDialogConfig, ngMaterial.MatDialogConfig); + +function IConfirmConfig() { + this.acceptButton = 'ACCEPT'; + this.acceptButtonColor = 'fds-primary'; + this.cancelButton = 'CANCEL'; + this.cancelButtonColor = 'fds-secondary'; +} + +IConfirmConfig.prototype = { + contstructor: IConfirmConfig +} + +$.extend(IConfirmConfig, IDialogConfig); + +function createConfig(config) { + var dialogConfig = new IConfirmConfig(); + dialogConfig.viewContainerRef = config.viewContainerRef; + dialogConfig.disableClose = config.disableClose; + return dialogConfig; +} + +/** + * FdsDialogService constructor. + * + * @param MatDialog The angular material MatDialog. + * @constructor + */ +function FdsDialogService(MatDialog) { + this.dialogService = MatDialog; +} + +FdsDialogService.prototype = { + contstructor: FdsDialogService, + + /** + * Wrapper function over the open() method in MatDialog. + * Opens a modal dialog containing the given component. + * + * @param component The angular ComponentType<T>. + * @param config The angular material MatDialogConfig. + * + * @returns {MatDialoRef} The reference to the dialog. + */ + open: function (component, config) { + return this.dialogService.open(component, config); + }, + + /** + * Wrapper function over the closeAll() method in MatDialog. + * Closes all of the currently-open dialogs. + */ + closeAll: function () { + this.dialogService.closeAll(); + }, + + /** + * Opens a confirm dialog with the provided config. + * + * @param config IConfirmConfig { + * message?: string; + * title?: string; + * dialogRef?: MatDialoRef; + * viewContainerRef?: ViewContainerRef; + * disableClose?: boolean; + * acceptButton?: string; + * acceptButtonColor?: string; + * cancelButton?: string; + * cancelButtonColor?: string; + * } + * + * @returns {MatDialoRef} The reference to the dialog. + */ + openConfirm: function (config) { + var dialogConfig = createConfig(config); + var dialogRef = this.dialogService.open(FdsConfirmDialogComponent, dialogConfig); + var confirmDialogComponent = dialogRef.componentInstance; + confirmDialogComponent.dialogRef = dialogRef; + if (config.title) { + confirmDialogComponent.title = config.title; + } + if (config.message) { + confirmDialogComponent.message = config.message; + } + if (config.acceptButton) { + confirmDialogComponent.acceptButton = config.acceptButton; + } + if (config.acceptButtonColor) { + confirmDialogComponent.acceptButtonColor = config.acceptButtonColor; + } + if (config.cancelButton) { + confirmDialogComponent.cancelButton = config.cancelButton; + } + if (config.cancelButtonColor) { + confirmDialogComponent.cancelButtonColor = config.cancelButtonColor; + } + return dialogRef; + }, +} + +FdsDialogService.parameters = [ngMaterial.MatDialog]; + +module.exports = { + IDialogConfig: IDialogConfig, + IConfirmConfig: IConfirmConfig, + FdsDialogService: FdsDialogService +}; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/fluid-design-system.module.js ---------------------------------------------------------------------- diff --git a/src/platform/core/fluid-design-system.module.js b/src/platform/core/fluid-design-system.module.js new file mode 100644 index 0000000..7a7aaec --- /dev/null +++ b/src/platform/core/fluid-design-system.module.js @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var $ = require('jquery'); +var ngCore = require('@angular/core'); +var ngFlex = require('@angular/flex-layout'); +var ngMaterial = require('@angular/material'); +var ngCommon = require('@angular/common'); +var ngPlatformBrowser = require('@angular/platform-browser'); +var ngAnimations = require('@angular/platform-browser/animations'); +var covalentCore = require('@covalent/core'); +var fdsDialogsModule = require('@fluid-design-system/dialogs'); +var fdsSnackBarsModule = require('@fluid-design-system/snackbars'); + +/** + * FluidDesignSystemModule constructor. + * + * @constructor + */ +function FluidDesignSystemModule() { + $(document).ready(function () { + //add fds attr to body tag to allow fine grain style overrides + document.body.setAttribute('fds', ''); + + //override the hover styles for checkbox borders + $(document.body).on('mouseenter', '.mat-checkbox-inner-container', function () { + $(this).find('.mat-checkbox-frame').css('border-color', '#1491C1'); + }); + $(document.body).on('mouseleave', '.mat-checkbox-inner-container', function () { + $(this).find('.mat-checkbox-frame').css('border-color', '#DDDDDD'); + }); + }); +}; + +FluidDesignSystemModule.prototype = { + constructor: FluidDesignSystemModule +}; + +FluidDesignSystemModule.annotations = [ + new ngCore.NgModule({ + imports: [ + ngFlex.FlexLayoutModule, + ngAnimations.BrowserAnimationsModule, + ngCommon.CommonModule, + ngPlatformBrowser.BrowserModule, + ngMaterial.MatAutocompleteModule, + ngMaterial.MatButtonModule, + ngMaterial.MatButtonToggleModule, + ngMaterial.MatCardModule, + ngMaterial.MatCheckboxModule, + ngMaterial.MatChipsModule, + ngMaterial.MatDatepickerModule, + ngMaterial.MatDialogModule, + ngMaterial.MatExpansionModule, + ngMaterial.MatFormFieldModule, + ngMaterial.MatGridListModule, + ngMaterial.MatIconModule, + ngMaterial.MatInputModule, + ngMaterial.MatListModule, + ngMaterial.MatMenuModule, + ngMaterial.MatProgressBarModule, + ngMaterial.MatProgressSpinnerModule, + ngMaterial.MatRadioModule, + ngMaterial.MatSelectModule, + ngMaterial.MatSlideToggleModule, + ngMaterial.MatSliderModule, + ngMaterial.MatSidenavModule, + ngMaterial.MatSnackBarModule, + ngMaterial.MatStepperModule, + ngMaterial.MatTabsModule, + ngMaterial.MatToolbarModule, + ngMaterial.MatTooltipModule, + ngMaterial.MatPaginatorModule, + ngMaterial.MatSortModule, + ngMaterial.MatTableModule, + covalentCore.CovalentCommonModule, + covalentCore.CovalentChipsModule, + covalentCore.CovalentDataTableModule, + covalentCore.CovalentDialogsModule, + fdsDialogsModule.FdsDialogsModule, + fdsSnackBarsModule.FdsSnackBarsModule, + covalentCore.CovalentExpansionPanelModule, + covalentCore.CovalentLoadingModule, + covalentCore.CovalentMenuModule, + covalentCore.CovalentNotificationsModule, + covalentCore.CovalentPagingModule, + covalentCore.CovalentSearchModule, + covalentCore.CovalentStepsModule + ], + exports: [ + ngFlex.FlexLayoutModule, + ngAnimations.BrowserAnimationsModule, + ngCommon.CommonModule, + ngPlatformBrowser.BrowserModule, + ngMaterial.MatAutocompleteModule, + ngMaterial.MatButtonModule, + ngMaterial.MatButtonToggleModule, + ngMaterial.MatCardModule, + ngMaterial.MatCheckboxModule, + ngMaterial.MatChipsModule, + ngMaterial.MatDatepickerModule, + ngMaterial.MatDialogModule, + ngMaterial.MatExpansionModule, + ngMaterial.MatFormFieldModule, + ngMaterial.MatGridListModule, + ngMaterial.MatIconModule, + ngMaterial.MatInputModule, + ngMaterial.MatListModule, + ngMaterial.MatMenuModule, + ngMaterial.MatProgressBarModule, + ngMaterial.MatProgressSpinnerModule, + ngMaterial.MatRadioModule, + ngMaterial.MatSelectModule, + ngMaterial.MatSlideToggleModule, + ngMaterial.MatSliderModule, + ngMaterial.MatSidenavModule, + ngMaterial.MatSnackBarModule, + ngMaterial.MatStepperModule, + ngMaterial.MatTabsModule, + ngMaterial.MatToolbarModule, + ngMaterial.MatTooltipModule, + ngMaterial.MatPaginatorModule, + ngMaterial.MatSortModule, + ngMaterial.MatTableModule, + covalentCore.CovalentCommonModule, + covalentCore.CovalentChipsModule, + covalentCore.CovalentDataTableModule, + covalentCore.CovalentDialogsModule, + fdsDialogsModule.FdsDialogsModule, + fdsSnackBarsModule.FdsSnackBarsModule, + covalentCore.CovalentExpansionPanelModule, + covalentCore.CovalentLoadingModule, + covalentCore.CovalentMenuModule, + covalentCore.CovalentNotificationsModule, + covalentCore.CovalentPagingModule, + covalentCore.CovalentSearchModule, + covalentCore.CovalentStepsModule + ] + }) +]; +module.exports = FluidDesignSystemModule; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/coaster/_coaster.component.scss ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/coaster/_coaster.component.scss b/src/platform/core/snackbars/coaster/_coaster.component.scss new file mode 100644 index 0000000..b207c8d --- /dev/null +++ b/src/platform/core/snackbars/coaster/_coaster.component.scss @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the 'License'); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +body[fds] snack-bar-container { + background: #FFFFFF; + padding: 0; + box-shadow: 0px 0px 3px 0px rgba(19, 145, 193, 1); +} + +fds-snackbar-title mat-icon.mat-icon.mat-primary.material-icons { + font-size: 10px; + height: 10px; + width: 10px; + line-height: 10px; + color: $grey3; +} + +.fds-coaster-message { + font-size: 12px; +} + +.fds-snackbar-title { + font-size: 14px; +} + +.fds-snackbar-title i { + font-size: 24px; +} + +.fds-coaster-icon { + position: absolute; + top: 24px; + left: 15px; +} + +.coaster-close-icon { + height: 10px !important; + width: 10px !important; + line-height: 10px !important; + right: 10px; + position: absolute !important; + top: 10px; +} + +.fds-snackbar-wrapper { + border-radius: 2px; + border-width: 1px; + border-style: solid; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/coaster/coaster.component.html ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/coaster/coaster.component.html b/src/platform/core/snackbars/coaster/coaster.component.html new file mode 100644 index 0000000..8b8414b --- /dev/null +++ b/src/platform/core/snackbars/coaster/coaster.component.html @@ -0,0 +1,33 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<fds-snackbar> + <fds-snackbar-title *ngIf="title"> + <button class="coaster-close-icon" mat-icon-button (click)="cancel()"> + <mat-icon color="primary">close</mat-icon> + </button> + <i *ngIf="icon" class="{{icon}} fds-coaster-icon" aria-hidden="true"></i> + <div class="ellipsis" fxLayout="row" title="{{title}}" fxLayoutAlign="space-between center"> + {{title}} + </div> + </fds-snackbar-title> + <fds-snackbar-content title="{{message}}" class="fds-coaster-message ellipsis tc-grey-700"> + {{message}} + </fds-snackbar-content> + <fds-snackbar-actions> + </fds-snackbar-actions> +</fds-snackbar> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/coaster/coaster.component.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/coaster/coaster.component.js b/src/platform/core/snackbars/coaster/coaster.component.js new file mode 100644 index 0000000..0213f2e --- /dev/null +++ b/src/platform/core/snackbars/coaster/coaster.component.js @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ngCore = require('@angular/core'); +var $ = require('jquery'); + +/** + * FdsCoasterComponent constructor. + * + * @constructor + */ +function FdsCoasterComponent() { + this.title = ''; + this.message = ''; + this.icon = ''; + this.color = ''; + this.snackBarRef = undefined; + this.viewContainerRef = undefined; +}; + +FdsCoasterComponent.prototype = { + constructor: FdsCoasterComponent, + + /** + * Initialize the component. + */ + ngAfterViewChecked: function () { + $('.fds-snackbar-wrapper').css('border-color', this.color); + $('.fds-snackbar-title').css('color', this.color); + $('.fds-coaster-icon').css('color', this.color); + + if (this.icon) { + $('.fds-snackbar-wrapper').css('padding', '15px 15px 15px 45px'); + } else { + $('.fds-snackbar-wrapper').css('padding', '15px 15px 15px 15px'); + } + }, + + /** + * Close the snackbar and send a cancel response to any subscribers. + */ + cancel: function () { + this.snackBarRef.dismiss(false); + } +}; + +FdsCoasterComponent.annotations = [ + new ngCore.Component({ + selector: 'fds-coaster', + template: require('./coaster.component.html!text') + }) +]; + +FdsCoasterComponent.parameters = []; + +module.exports = FdsCoasterComponent; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/coaster/coaster.component.spec.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/coaster/coaster.component.spec.js b/src/platform/core/snackbars/coaster/coaster.component.spec.js new file mode 100644 index 0000000..0959791 --- /dev/null +++ b/src/platform/core/snackbars/coaster/coaster.component.spec.js @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var CoasterComponent = require('@fluid-design-system/coaster-component'); + +describe('coasterComponent isolated unit tests', function () { + var coaster; + + beforeEach(function () { + coaster = new CoasterComponent(); + }); + + it('should have defined coaster', function () { + coaster.ngAfterViewChecked(); + //assertions + expect(coaster).toBeDefined(); + }); +}); http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/fds-snackbar.component.html ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/fds-snackbar.component.html b/src/platform/core/snackbars/fds-snackbar.component.html new file mode 100644 index 0000000..f3c6def --- /dev/null +++ b/src/platform/core/snackbars/fds-snackbar.component.html @@ -0,0 +1,29 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<div class="fds-snackbar-wrapper"> + <div class="fds-snackbar-title md-title" *ngIf="snackBarTitle.length > 0"> + <ng-content select="fds-snackbar-title"></ng-content> + </div> + <div class="fds-snackbar-content" *ngIf="snackBarContent.length > 0"> + <ng-content select="fds-snackbar-content"></ng-content> + </div> + <div class="fds-snackbar-actions" *ngIf="snackBarActions.length > 0" layout="row"> + <span flex></span> + <ng-content select="fds-snackbar-actions"></ng-content> + </div> +</div> http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/fds-snackbar.component.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/fds-snackbar.component.js b/src/platform/core/snackbars/fds-snackbar.component.js new file mode 100644 index 0000000..959f6dc --- /dev/null +++ b/src/platform/core/snackbars/fds-snackbar.component.js @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ngCore = require('@angular/core'); + +function FdsSnackBarTitleDirective() { +} + +FdsSnackBarTitleDirective.prototype = { + contstructor: FdsSnackBarTitleDirective +} + +FdsSnackBarTitleDirective.decorators = [ + { type: ngCore.Directive, args: [{ selector: 'fds-snackbar-title' },] }, +]; + +function FdsSnackBarContentDirective() { +} + +FdsSnackBarContentDirective.prototype = { + contstructor: FdsSnackBarContentDirective +} + +FdsSnackBarContentDirective.decorators = [ + { type: ngCore.Directive, args: [{ selector: 'fds-snackbar-content' },] }, +]; + +function FdsSnackBarActionsDirective() { +} + +FdsSnackBarActionsDirective.prototype = { + contstructor: FdsSnackBarActionsDirective +} + +FdsSnackBarActionsDirective.decorators = [ + { type: ngCore.Directive, args: [{ selector: 'fds-snackbar-actions' },] }, +]; + +/** + * FdsSnackBarComponent constructor + * + * @constructor + */ +function FdsSnackBarComponent() { + this.snackBarTitle = ''; + this.snackBarContent = ''; + this.snackBarActions = ''; +}; + +FdsSnackBarComponent.prototype = { + constructor: FdsSnackBarComponent, + + /** + * Respond after Angular projects external content into the component's view. + */ + ngAfterContentInit: function () { + if (this.snackBarTitle.length > 1) { + throw new Error('Duplicate fds-snackbar-title component at in fds-snackbar.'); + } + if (this.snackBarContent.length > 1) { + throw new Error('Duplicate fds-snackbar-content component at in fds-snackbar.'); + } + if (this.snackBarActions.length > 1) { + throw new Error('Duplicate fds-snackbar-actions component at in fds-snackbar.'); + } + } +} + +FdsSnackBarComponent.annotations = [ + new ngCore.Component({ + selector: 'fds-snackbar', + template: require('./fds-snackbar.component.html!text'), + queries: { + snackBarTitle: new ngCore.ContentChildren(FdsSnackBarTitleDirective), + snackBarContent: new ngCore.ContentChildren(FdsSnackBarContentDirective), + snackBarActions: new ngCore.ContentChildren(FdsSnackBarActionsDirective) + } + }) +]; + +FdsSnackBarComponent.parameters = []; + +module.exports = { + FdsSnackBarTitleDirective: FdsSnackBarTitleDirective, + FdsSnackBarContentDirective: FdsSnackBarContentDirective, + FdsSnackBarActionsDirective: FdsSnackBarActionsDirective, + FdsSnackBarComponent: FdsSnackBarComponent +}; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/fds-snackbar.component.spec.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/fds-snackbar.component.spec.js b/src/platform/core/snackbars/fds-snackbar.component.spec.js new file mode 100644 index 0000000..355af94 --- /dev/null +++ b/src/platform/core/snackbars/fds-snackbar.component.spec.js @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var fdsSnackBarComponent = require('@fluid-design-system/snackbar-component'); + +describe('FdsSnackBarComponent isolated unit tests', function () { + var fdsSnackBar; + + beforeEach(function () { + fdsSnackBar = new fdsSnackBarComponent.FdsSnackBarComponent(); + }); + + it('should have defined fdsSnackBar', function () { + fdsSnackBar.ngAfterContentInit(); + //assertions + expect(fdsSnackBar).toBeDefined(); + }); +}); http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/fds-snackbars.module.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/fds-snackbars.module.js b/src/platform/core/snackbars/fds-snackbars.module.js new file mode 100644 index 0000000..657b1ae --- /dev/null +++ b/src/platform/core/snackbars/fds-snackbars.module.js @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ngCore = require('@angular/core'); +var ngMaterial = require('@angular/material'); +var ngFlex = require('@angular/flex-layout'); +var ngCommon = require('@angular/common'); +var ngForms = require('@angular/forms'); +var fdsSnackBarComponentModule = require('@fluid-design-system/snackbar-component'); +var fdsSnackBarServiceModule = require('@fluid-design-system/snackbar-service'); +var FdsCoasterComponent = require('@fluid-design-system/coaster-component'); + +var FDS_SNACKBARS = [ + fdsSnackBarComponentModule.FdsSnackBarComponent, + fdsSnackBarComponentModule.FdsSnackBarTitleDirective, + fdsSnackBarComponentModule.FdsSnackBarActionsDirective, + fdsSnackBarComponentModule.FdsSnackBarContentDirective, + FdsCoasterComponent +]; + +var FDS_SNACKBARS_ENTRY_COMPONENTS = [ + FdsCoasterComponent +]; + +/** + * FdsSnackBarsModule constructor. + * + * @constructor + */ +function FdsSnackBarsModule() { + +}; + +FdsSnackBarsModule.prototype = { + constructor: FdsSnackBarsModule +}; + +FdsSnackBarsModule.annotations = [ + new ngCore.NgModule({ + imports: [ + ngFlex.FlexLayoutModule, + ngForms.FormsModule, + ngCommon.CommonModule, + ngMaterial.MatSnackBarModule, + ngMaterial.MatInputModule, + ngMaterial.MatButtonModule, + ngMaterial.MatIconModule + ], + declarations: [ + FDS_SNACKBARS + ], + exports: [ + FDS_SNACKBARS + ], + providers: [ + fdsSnackBarServiceModule.FdsSnackBarService + ], + entryComponents: [ + FDS_SNACKBARS_ENTRY_COMPONENTS + ] + }) +]; + +module.exports = { + FdsSnackBarsModule: FdsSnackBarsModule, + ICoasterConfig: fdsSnackBarServiceModule.ICoasterConfig, + FdsSnackBarService: fdsSnackBarServiceModule.FdsSnackBarService, + FdsSnackBarComponent: fdsSnackBarComponentModule.FdsSnackBarComponent, + FdsSnackBarTitleDirective: fdsSnackBarComponentModule.FdsSnackBarTitleDirective, + FdsSnackBarContentDirective: fdsSnackBarComponentModule.FdsSnackBarContentDirective, + FdsSnackBarActionsDirective: fdsSnackBarComponentModule.FdsSnackBarActionsDirective, + FdsCoasterComponent: FdsCoasterComponent +}; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/snackbars/services/snackbar.service.js ---------------------------------------------------------------------- diff --git a/src/platform/core/snackbars/services/snackbar.service.js b/src/platform/core/snackbars/services/snackbar.service.js new file mode 100644 index 0000000..e02e505 --- /dev/null +++ b/src/platform/core/snackbars/services/snackbar.service.js @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var ngCore = require('@angular/core'); +var ngMaterial = require('@angular/material'); +var FdsCoasterComponent = require('@fluid-design-system/coaster-component'); +var $ = require('jquery'); + +function ISnackBarConfig() { + this.title = ''; + this.message = ''; + this.snackBarRef = undefined; + this.viewContainerRef = undefined; +} + +ISnackBarConfig.prototype = { + contstructor: ISnackBarConfig +} + +$.extend(ISnackBarConfig, ngMaterial.MatSnackBarConfig); + +function ICoasterConfig() { + this.icon = ''; + this.color = ''; +} + +ICoasterConfig.prototype = { + contstructor: ICoasterConfig +} + +$.extend(ICoasterConfig, ISnackBarConfig); + +/** + * FdsSnackBarService constructor. + * + * @param MatSnackBar The angular material MatSnackBar. + * @constructor + */ +function FdsSnackBarService(MatSnackBar) { + this.snackBarService = MatSnackBar; +} + +FdsSnackBarService.prototype = { + contstructor: FdsSnackBarService, + + /** + * Wrapper function over the open() method in MatSnackBar. + * + * @param message The message to show in the snackbar. + * @param action The label for the snackbar action. + * @param config Additional configuration options for the snackbar. + * + * @returns {MatSnackBarRef} The reference to the snackbar. + */ + open: function (message, action, config) { + return this.snackBarService.open(message, action, config); + }, + + /** + * Wrapper function over the openFromComponent() method in MatSnackBar. + * Opens a snackbar containing the given component. + * + * @param component The angular ComponentType<T>. + * @param config The angular material MatSnackBarConfig. + * + * @returns {MatSnackBarRef} The reference to the snackbar. + */ + openFromComponent: function (component, config) { + return this.snackBarService.openFromComponent(component, config); + }, + + /** + * Wrapper function over the dismiss() method in MatSnackBar. + * Dismisses the currently-open snackbar. + */ + dismiss: function () { + this.snackBarService.dismiss(); + }, + + /** + * Opens a coaster snackbar with the provided config. + * + * @param config ICoasterConfig { + * message?: string; + * title?: string; + * snackBarRef?: MatSnackBarRef; + * viewContainerRef?: ViewContainerRef; + * icon?: string; + * color?: string; + * } + * + * @returns {MatSnackBarRef} The reference to the snackbar. + */ + openCoaster: function (config) { + var snackBarConfig = new ICoasterConfig(); + snackBarConfig.verticalPosition = config.verticalPosition; + snackBarConfig.horizontalPosition = config.horizontalPosition; + snackBarConfig.duration = config.duration; + var snackBarRef = this.snackBarService.openFromComponent(FdsCoasterComponent, snackBarConfig); + var coasterComponent = snackBarRef.instance; + coasterComponent.snackBarRef = snackBarRef; + if (config.title) { + coasterComponent.title = config.title; + } + if (config.message) { + coasterComponent.message = config.message; + } + if (config.icon) { + coasterComponent.icon = config.icon; + } + if (config.color) { + coasterComponent.color = config.color; + } + return snackBarRef; + }, +} + +FdsSnackBarService.parameters = [ngMaterial.MatSnackBar]; + +module.exports = { + ISnackBarConfig: ISnackBarConfig, + ICoasterConfig: ICoasterConfig, + FdsSnackBarService: FdsSnackBarService +}; http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/core/theming/_all-theme.scss ---------------------------------------------------------------------- diff --git a/src/platform/core/theming/_all-theme.scss b/src/platform/core/theming/_all-theme.scss new file mode 100644 index 0000000..747ab8b --- /dev/null +++ b/src/platform/core/theming/_all-theme.scss @@ -0,0 +1,36 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@import '../../../node_modules/@angular/material/theming'; +@import '../../../node_modules/@covalent/core/theming/all-theme'; +@import '../common/styles/buttons'; +@import '../common/styles/expansionPanels'; +@import '../common/styles/menus'; + +// Create a theme. +@mixin fds-theme($theme) { + + // Include theme styles for core and each component used in your app. + // Alternatively, you can import and @include the theme mixins for each component + // that you are using. + @include angular-material-theme($theme); + @include covalent-theme($theme); + @include fds-buttons-theme($theme); + @include fds-expansion-panels-theme($theme); + @include fds-menus-theme($theme); + +} http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/src/platform/systemjs.spec.config.js ---------------------------------------------------------------------- diff --git a/src/platform/systemjs.spec.config.js b/src/platform/systemjs.spec.config.js new file mode 100644 index 0000000..1f51a7a --- /dev/null +++ b/src/platform/systemjs.spec.config.js @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (global) { + System.config({ + paths: { + // paths serve as alias + 'npm:': 'fds/node_modules/' + }, + // map tells the System loader where to look for things + map: { + 'text': 'npm:systemjs-plugin-text/text.js', + 'app': './platform', + + // jquery + 'jquery': 'npm:jquery/dist/jquery.min.js', + + // Angular + '@angular/core': 'npm:@angular/core/bundles/core.umd.js', + '@angular/common': 'npm:@angular/common/bundles/common.umd.js', + '@angular/common/http': 'npm:@angular/common/bundles/common-http.umd.js', + '@angular/common/http/testing': 'npm:@angular/common/bundles/common-http-testing.umd.js', + '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', + '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', + '@angular/http': 'npm:@angular/http/bundles/http.umd.js', + '@angular/router': 'npm:@angular/router/bundles/router.umd.js', + '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', + '@angular/flex-layout': 'npm:@angular/flex-layout/bundles/flex-layout.umd.js', + '@angular/flex-layout/core': 'npm:@angular/flex-layout/bundles/flex-layout-core.umd.js', + '@angular/flex-layout/extended': 'npm:@angular/flex-layout/bundles/flex-layout-extended.umd.js', + '@angular/flex-layout/flex': 'npm:@angular/flex-layout/bundles/flex-layout-flex.umd.js', + '@angular/material': 'npm:@angular/material/bundles/material.umd.js', + '@angular/material/core': 'npm:@angular/material/bundles/material-core.umd.js', + '@angular/material/card': 'npm:@angular/material/bundles/material-card.umd.js', + '@angular/material/divider': 'npm:@angular/material/bundles/material-divider.umd.js', + '@angular/material/progress-bar': 'npm:@angular/material/bundles/material-progress-bar.umd.js', + '@angular/material/progress-spinner': 'npm:@angular/material/bundles/material-progress-spinner.umd.js', + '@angular/material/chips': 'npm:@angular/material/bundles/material-chips.umd.js', + '@angular/material/input': 'npm:@angular/material/bundles/material-input.umd.js', + '@angular/material/icon': 'npm:@angular/material/bundles/material-icon.umd.js', + '@angular/material/button': 'npm:@angular/material/bundles/material-button.umd.js', + '@angular/material/checkbox': 'npm:@angular/material/bundles/material-checkbox.umd.js', + '@angular/material/tooltip': 'npm:@angular/material/bundles/material-tooltip.umd.js', + '@angular/material/dialog': 'npm:@angular/material/bundles/material-dialog.umd.js', + '@angular/material/sidenav': 'npm:@angular/material/bundles/material-sidenav.umd.js', + '@angular/material/menu': 'npm:@angular/material/bundles/material-menu.umd.js', + '@angular/material/form-field': 'npm:@angular/material/bundles/material-form-field.umd.js', + '@angular/material/toolbar': 'npm:@angular/material/bundles/material-toolbar.umd.js', + '@angular/material/autocomplete': 'npm:@angular/material/bundles/material-autocomplete.umd.js', + '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js', + '@angular/cdk': 'npm:@angular/cdk/bundles/cdk.umd.js', + '@angular/cdk/a11y': 'npm:@angular/cdk/bundles/cdk-a11y.umd.js', + '@angular/cdk/accordion': 'npm:@angular/cdk/bundles/cdk-accordion.umd.js', + '@angular/cdk/layout': 'npm:@angular/cdk/bundles/cdk-layout.umd.js', + '@angular/cdk/collections': 'npm:@angular/cdk/bundles/cdk-collections.umd.js', + '@angular/cdk/observers': 'npm:@angular/cdk/bundles/cdk-observers.umd.js', + '@angular/cdk/overlay': 'npm:@angular/cdk/bundles/cdk-overlay.umd.js', + '@angular/cdk/platform': 'npm:@angular/cdk/bundles/cdk-platform.umd.js', + '@angular/cdk/portal': 'npm:@angular/cdk/bundles/cdk-portal.umd.js', + '@angular/cdk/keycodes': 'npm:@angular/cdk/bundles/cdk-keycodes.umd.js', + '@angular/cdk/bidi': 'npm:@angular/cdk/bundles/cdk-bidi.umd.js', + '@angular/cdk/coercion': 'npm:@angular/cdk/bundles/cdk-coercion.umd.js', + '@angular/cdk/table': 'npm:@angular/cdk/bundles/cdk-table.umd.js', + '@angular/cdk/rxjs': 'npm:@angular/cdk/bundles/cdk-rxjs.umd.js', + '@angular/cdk/scrolling': 'npm:@angular/cdk/bundles/cdk-scrolling.umd.js', + '@angular/cdk/stepper': 'npm:@angular/cdk/bundles/cdk-stepper.umd.js', + '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js', + '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js', + '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', + + // needed to support gestures for angular material + 'hammerjs': 'npm:hammerjs/hammer.min.js', + + // Covalent + '@covalent/core': 'npm:@covalent/core/bundles/covalent-core.umd.min.js', + '@covalent/core/common': 'npm:@covalent/core/bundles/covalent-core-common.umd.min.js', + + // other libraries + 'rxjs': 'npm:rxjs', + 'zone.js': 'npm:zone.js/dist/zone.js', + + // Fluid Design System + '@fluid-design-system/core': 'platform/core/fluid-design-system.module.js', + '@fluid-design-system/dialogs': 'platform/core/dialogs/fds-dialogs.module.js', + '@fluid-design-system/dialog-component': 'platform/core/dialogs/fds-dialog.component.js', + '@fluid-design-system/dialog-service': 'platform/core/dialogs/services/dialog.service.js', + '@fluid-design-system/confirm-dialog-component': 'platform/core/dialogs/confirm-dialog/confirm-dialog.component.js', + '@fluid-design-system/snackbars': 'platform/core/snackbars/fds-snackbars.module.js', + '@fluid-design-system/snackbar-component': 'platform/core/snackbars/fds-snackbar.component.js', + '@fluid-design-system/snackbar-service': 'platform/core/snackbars/services/snackbar.service.js', + '@fluid-design-system/coaster-component': 'platform/core/snackbars/coaster/coaster.component.js', + '@fluid-design-system/common/storage-service': 'platform/core/common/services/fds-storage.service.js' + }, + // packages tells the System loader how to load when no filename and/or no extension + packages: { + 'rxjs': { + defaultExtension: 'js' + } + } + }); +})(this); http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/test/karma-test-shim.js ---------------------------------------------------------------------- diff --git a/test/karma-test-shim.js b/test/karma-test-shim.js new file mode 100644 index 0000000..eeeb18d --- /dev/null +++ b/test/karma-test-shim.js @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// /*global jasmine, __karma__, window*/ +Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing. + +// Uncomment to get full stacktrace output. Sometimes helpful, usually not. +// Error.stackTraceLimit = Infinity; // + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; + +// builtPaths: root paths for output ("built") files +// get from karma.config.js, then prefix with '/base/' +var builtPaths = (__karma__.config.builtPaths) + .map(function (p) { + return '/base/' + p; + }); + +__karma__.loaded = function () { +}; + +function isJsFile(path) { + return path.slice(-3) == '.js'; +} + +function isSpecFile(path) { + return /\.spec\.(.*\.)?js$/.test(path); +} + +// Is a "built" file if is JavaScript file in one of the "built" folders +function isBuiltFile(path) { + return isJsFile(path) && + builtPaths.reduce(function (keep, bp) { + return keep || (path.substr(0, bp.length) === bp); + }, false); +} + +var allSpecFiles = Object.keys(window.__karma__.files) + .filter(isSpecFile) + .filter(isBuiltFile); + +System.config({ + // Base URL for System.js calls. 'base/' is where Karma serves files from. + baseURL: 'base', + + // Map the angular testing umd bundles + map: { + '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js', + '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js', + '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js', + '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js', + '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js', + '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js', + '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js', + '@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js' + } +}); + +System.import('platform/systemjs.spec.config.js') + .then(initTestBed) + .then(initTesting); + +/** Optional SystemJS configuration extras. Keep going w/o it */ +function importSystemJsExtras() { + return System.import('platform/systemjs.config.extras.js') + .catch(function (reason) { + console.log( + 'Warning: System.import could not load the optional "systemjs.config.extras.js". Did you omit it by accident? Continuing without it.' + ); + console.log(reason); + }); +} + +function initTestBed() { + return Promise.all([ + System.import('@angular/core/testing'), + System.import('@angular/platform-browser-dynamic/testing') + ]) + + .then(function (providers) { + var coreTesting = providers[0]; + var browserTesting = providers[1]; + + coreTesting.TestBed.initTestEnvironment( + browserTesting.BrowserDynamicTestingModule, + browserTesting.platformBrowserDynamicTesting()); + }) +} + +// Import all spec files and start karma +function initTesting() { + return Promise.all( + allSpecFiles.map(function (moduleName) { + return System.import(moduleName); + }) + ) + .then(__karma__.start, __karma__.error); +} http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/c85638d8/test/karma.conf.js ---------------------------------------------------------------------- diff --git a/test/karma.conf.js b/test/karma.conf.js new file mode 100644 index 0000000..19f0125 --- /dev/null +++ b/test/karma.conf.js @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = function (config) { + + var appBase = 'platform/'; // app JS and map files + + config.set({ + basePath: '', + browserNoActivityTimeout: 9999999, //default 10000 + browserDisconnectTimeout: 999999, // default 2000 + browserDisconnectTolerance: 1, // default 0 + captureTimeout: 999999, + frameworks: ['jasmine'], + customLaunchers: { + Chrome_travis_ci: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'] + } + }, + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-spec-reporter'), + require('karma-coverage') + ], + + client: { + builtPaths: [appBase], // add more spec base paths as needed + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + + files: [ + // System.js for module loading + 'node_modules/systemjs/dist/system.src.js', + + // Polyfills + 'node_modules/core-js/client/shim.js', + + // zone.js + 'node_modules/zone.js/dist/zone.js', + 'node_modules/zone.js/dist/long-stack-trace-zone.js', + 'node_modules/zone.js/dist/proxy.js', + 'node_modules/zone.js/dist/sync-test.js', + 'node_modules/zone.js/dist/jasmine-patch.js', + 'node_modules/zone.js/dist/async-test.js', + 'node_modules/zone.js/dist/fake-async-test.js', + + // RxJs + {pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false}, + + // Paths loaded via module imports: + {pattern: 'node_modules/systemjs/**/*.js.map', included: false, watched: false}, + {pattern: 'node_modules/@angular/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false}, + {pattern: 'node_modules/jquery/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/systemjs-plugin-text/text.js', included: false, watched: false}, + + {pattern: appBase + 'systemjs.spec.config.js', included: false, watched: false}, + 'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels + + // Include the Fluid Design System templates in the test suite. + { + pattern: 'platform/core/**/*.html', + included: true, + watched: true, + served: true + }, + + // Paths for debugging with source maps in dev tools + {pattern: appBase + '**/*.css.map', included: false, watched: false}, + {pattern: appBase + '**/*.js', included: false, watched: false} + ], + + // Proxied base paths for loading assets + proxies: { + // required for modules fetched by SystemJS + '/base/fds/node_modules/': '/base/node_modules/' + }, + + exclude: [], + preprocessors: { + 'platform/**/!(*spec|*mock|*stub|*config|*extras|).js': 'coverage' + }, + reporters: ['kjhtml', 'spec', 'coverage'], + coverageReporter: { + type: 'html', + dir: 'coverage/' + }, + specReporter: { + failFast: false + }, + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); + + if (process.env.TRAVIS) { + config.set({ + browsers: ['Chrome_travis_ci'] + }); + + // Override base config + config.set({ + singleRun: true, + autoWatch: false, + reporters: ['spec', 'coverage'], + specReporter: { + failFast: true + } + }); + } +}
