Skip to content

Commit

Permalink
chore(autocomplete): add autocomplete scaffold (#2092)
Browse files Browse the repository at this point in the history
  • Loading branch information
kara authored and mmalerba committed Dec 7, 2016
1 parent 62cc830 commit 4c49f5f
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/demo-app/autocomplete/autocomplete-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="demo-autocomplete">
<md-autocomplete></md-autocomplete>
</div>
1 change: 1 addition & 0 deletions src/demo-app/autocomplete/autocomplete-demo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.demo-autocomplete {}
9 changes: 9 additions & 0 deletions src/demo-app/autocomplete/autocomplete-demo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Component} from '@angular/core';

@Component({
moduleId: module.id,
selector: 'autocomplete-demo',
templateUrl: 'autocomplete-demo.html',
styleUrls: ['autocomplete-demo.css'],
})
export class AutocompleteDemo {}
2 changes: 2 additions & 0 deletions src/demo-app/demo-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {MenuDemo} from './menu/menu-demo';
import {TabsDemo, SunnyTabContent, RainyTabContent, FoggyTabContent} from './tabs/tabs-demo';
import {ProjectionDemo, ProjectionTestComponent} from './projection/projection-demo';
import {PlatformDemo} from './platform/platform-demo';
import {AutocompleteDemo} from './autocomplete/autocomplete-demo';

@NgModule({
imports: [
Expand All @@ -47,6 +48,7 @@ import {PlatformDemo} from './platform/platform-demo';
MaterialModule.forRoot(),
],
declarations: [
AutocompleteDemo,
BaselineDemo,
ButtonDemo,
ButtonToggleDemo,
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/demo-app/demo-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Home {}
})
export class DemoApp {
navItems = [
{name: 'Autocomplete', route: 'autocomplete'},
{name: 'Button', route: 'button'},
{name: 'Button Toggle', route: 'button-toggle'},
{name: 'Card', route: 'card'},
Expand Down
2 changes: 2 additions & 0 deletions src/demo-app/demo-app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ import {SnackBarDemo} from '../snack-bar/snack-bar-demo';
import {ProjectionDemo} from '../projection/projection-demo';
import {TABS_DEMO_ROUTES} from '../tabs/routes';
import {PlatformDemo} from '../platform/platform-demo';
import {AutocompleteDemo} from '../autocomplete/autocomplete-demo';

export const DEMO_APP_ROUTES: Routes = [
{path: '', component: Home},
{path: 'autocomplete', component: AutocompleteDemo},
{path: 'button', component: ButtonDemo},
{path: 'card', component: CardDemo},
{path: 'chips', component: ChipsDemo},
Expand Down
5 changes: 5 additions & 0 deletions src/lib/autocomplete/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

## Not yet implemented!

The autocomplete is not yet implemented. This is only a scaffold to make
subsequent PRs easier to read. Please do not try to use yet :)
5 changes: 5 additions & 0 deletions src/lib/autocomplete/_autocomplete-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import '../core/theming/theming';

@mixin md-autocomplete-theme($theme) {

}
1 change: 1 addition & 0 deletions src/lib/autocomplete/autocomplete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an autocomplete!
Empty file.
29 changes: 29 additions & 0 deletions src/lib/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {TestBed, async} from '@angular/core/testing';
import {Component} from '@angular/core';
import {MdAutocompleteModule} from './index';

describe('MdAutocomplete', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdAutocompleteModule.forRoot()],
declarations: [SimpleAutocomplete],
providers: []
});

TestBed.compileComponents();
}));

it('should have a test', () => {
expect(true).toBe(true);
});

});

@Component({
template: `
<md-autocomplete></md-autocomplete>
`
})
class SimpleAutocomplete {}

11 changes: 11 additions & 0 deletions src/lib/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Component, ViewEncapsulation} from '@angular/core';

@Component({
moduleId: module.id,
selector: 'md-autocomplete, mat-autocomplete',
templateUrl: 'autocomplete.html',
styleUrls: ['autocomplete.css'],
encapsulation: ViewEncapsulation.None,
})
export class MdAutocomplete {}

18 changes: 18 additions & 0 deletions src/lib/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {ModuleWithProviders, NgModule} from '@angular/core';
import {DefaultStyleCompatibilityModeModule} from '../core';
import {MdAutocomplete} from './autocomplete';
export * from './autocomplete';

@NgModule({
imports: [DefaultStyleCompatibilityModeModule],
exports: [MdAutocomplete, DefaultStyleCompatibilityModeModule],
declarations: [MdAutocomplete],
})
export class MdAutocompleteModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdAutocompleteModule,
providers: []
};
}
}
1 change: 1 addition & 0 deletions src/lib/core/compatibility/default-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const MATERIAL_COMPATIBILITY_MODE = new OpaqueToken('md-compatibiility-mo

/** Selector that matches all elements that may have style collisions with material1. */
export const MAT_ELEMENTS_SELECTOR = `
mat-autocomplete,
mat-card,
mat-card-actions,
mat-card-content,
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/compatibility/no-conflict-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {MATERIAL_COMPATIBILITY_MODE} from './default-mode';

/** Selector that matches all elements that may have style collisions with material1. */
export const MD_ELEMENTS_SELECTOR = `
md-autocomplete,
md-card,
md-card-actions,
md-card-content,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/core/theming/_all-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Import all the theming functionality.
@import '../core';
@import '../../autocomplete/autocomplete-theme';
@import '../../button/button-theme';
@import '../../button-toggle/button-toggle-theme';
@import '../../card/card-theme';
Expand All @@ -26,6 +27,7 @@
// Create a theme.
@mixin angular-material-theme($theme) {
@include md-core-theme($theme);
@include md-autocomplete-theme($theme);
@include md-button-theme($theme);
@include md-button-toggle-theme($theme);
@include md-card-theme($theme);
Expand Down
4 changes: 3 additions & 1 deletion src/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ import {MdTooltipModule} from './tooltip/index';
import {MdMenuModule} from './menu/index';
import {MdDialogModule} from './dialog/index';
import {PlatformModule} from './core/platform/platform';

import {MdAutocompleteModule} from './autocomplete/index';

const MATERIAL_MODULES = [
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
Expand Down Expand Up @@ -70,6 +71,7 @@ const MATERIAL_MODULES = [

@NgModule({
imports: [
MdAutocompleteModule.forRoot(),
MdButtonModule.forRoot(),
MdCardModule.forRoot(),
MdChipsModule.forRoot(),
Expand Down

0 comments on commit 4c49f5f

Please sign in to comment.