Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(MdInput): Input should not be treated as empty if it is a date field. #846

Merged
merged 20 commits into from
Sep 6, 2016
Merged
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d860394
fix(MdInput): Input should not be treated as empty if it is a date fi…
drager Jul 12, 2016
17465c9
fix(MdInput): Input should not be treated as empty if it is a date fi…
drager Jul 12, 2016
5262e6b
fix(md-input): Check for type in empty getter instead
drager Jul 12, 2016
121486a
test(MdInput): Add tests for empty check
drager Jul 14, 2016
22b0576
test(MdInput): Update empty check tests to match the other tests new …
drager Jul 14, 2016
07885d0
test(MdInput): Fix linting issue
drager Jul 15, 2016
b434d54
Merge branch 'master' of github.com:angular/material2
drager Jul 20, 2016
e4dc755
fix(md-input): Check for type in empty getter instead
drager Jul 12, 2016
9dabcc0
fix(MdInput): Input should not be treated as empty if it is a date fi…
drager Jul 12, 2016
5bc3f61
fix(md-input): Check for type in empty getter instead
drager Jul 12, 2016
ece4232
test(MdInput): Add tests for empty check
drager Jul 14, 2016
920da03
test(MdInput): Update empty check tests to match the other tests new …
drager Jul 14, 2016
4cdac2b
Merge branch 'fix-md-input-date' of github.com:drager/material2 into …
drager Jul 20, 2016
8987153
test(MdInput): Skip empty check tests for IE11
drager Jul 27, 2016
62e0fa5
Merge branch 'master' of github.com:angular/material2
drager Jul 27, 2016
c089b27
Merge branch 'master' into fix-md-input-date
drager Jul 27, 2016
a0b2e26
test(MdInput): Resolve linting issues
drager Jul 27, 2016
883e2fb
Merge branch 'master' of github.com:angular/material2
drager Sep 6, 2016
5882611
Merge branch 'master' into fix-md-input-date
drager Sep 6, 2016
ba12423
test(MdInput): Update empty() check tests to match new test syntax
drager Sep 6, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
12 changes: 2 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -24,19 +24,11 @@ env:
- BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB
- ARCH=linux-x64
- BROWSER_PROVIDER_READY_FILE=/tmp/angular-material2-build/readyfile
# Token for tsd to increase github rate limit
# See https://github.com/DefinitelyTyped/tsd#tsdrc
# This does not use http://docs.travis-ci.com/user/environment-variables/#Secure-Variables
# because those are not visible for pull requests, and those should also be reliable.
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
# (password is in Valentine)
- TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}'
# GITHUB_TOKEN_ANGULAR
- secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo="
matrix:
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
- MODE=lint
- MODE=circular_deps
- MODE=extract_metadata
- MODE=e2e
- MODE=saucelabs_required
@@ -45,19 +37,19 @@ env:
- MODE=browserstack_optional

matrix:
fast_finish: true
allow_failures:
- env: "MODE=saucelabs_optional"
- env: "MODE=browserstack_optional"

install:
- npm install
- npm run typings

before_script:
- mkdir -p $LOGS_DIR

script:
- ./scripts/ci/build-and-test.sh
- ./scripts/ci/build-and-test.sh

cache:
directories:
124 changes: 118 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,117 @@
<a name="2.0.0-alpha.8"></a>
# [2.0.0-alpha.8 ectoplasm-helicopter](https://github.com/angular/material2/compare/g3_v2_0...2.0.0-alpha.8) (2016-09-01)

### Breaking Changes

* all: we've updated our packaging to match angular/angular's packaging. If you're using SystemJS in your project, you will probably want to
switch to using our UMD bundles. Example config:

```ts
'@angular2-material/core': {
format: 'cjs',
main: 'core.umd.js'
}
```

You can see a more detailed example in our demo app's system config [here](https://github.com/angular/material2/blob/master/src/demo-app/system-config.ts).

* all: material modules must be included with `forRoot()` when bootstrapping. See the [ngModules guide](https://angular.io/docs/ts/latest/cookbook/ngmodule-faq.html#!#q-for-root) for
more information.

```ts
@NgModule({
imports: [
MdCoreModule.forRoot()
MdRadioModule.forRoot(),
MdIconModule.forRoot()
]
...
});
```

* input: `md-input` attributes now match the casing of native attributes. Previously they were camel-cased; now they are all lowercase.
Example: `autoComplete` is now `autocomplete`. See [#1066](https://github.com/angular/material2/pull/1066) for a full list.

* overlay: overlays are now synchronous. This means actions like creating an overlay no longer return a promise.


### Bug Fixes

* **button:** hover styles no longer applied to disabled buttons ([#909](https://github.com/angular/material2/issues/909)) ([21e419d](https://github.com/angular/material2/commit/21e419d)), closes [#866](https://github.com/angular/material2/issues/866)
* **button:** stop using `Type` from [@angular](https://github.com/angular) ([#991](https://github.com/angular/material2/issues/991)) ([97d3ed3](https://github.com/angular/material2/commit/97d3ed3))
* **button-toggle:** toggle group should not emit an initial change event. ([#1144](https://github.com/angular/material2/issues/1144)) ([e5830d1](https://github.com/angular/material2/commit/e5830d1))
* **card:** remove unnecessary intermediate div ([#1068](https://github.com/angular/material2/issues/1068)) ([b5e1e33](https://github.com/angular/material2/commit/b5e1e33))
* **checkbox:** export TransitionCheckState enum ([#1147](https://github.com/angular/material2/issues/1147)) ([cda90f3](https://github.com/angular/material2/commit/cda90f3))
* **input:** make attributes match native ones ([#1066](https://github.com/angular/material2/issues/1066)) ([f3a7b91](https://github.com/angular/material2/commit/f3a7b91)), closes [#1065](https://github.com/angular/material2/issues/1065)
* **ngc:** _onDragStart/End are called with one param ([#1113](https://github.com/angular/material2/issues/1113)) ([6e5d260](https://github.com/angular/material2/commit/6e5d260)), closes [#1112](https://github.com/angular/material2/issues/1112)
* **ngc:** don't emit HTMLElement in JS files ([#1061](https://github.com/angular/material2/issues/1061)) ([32eacd2](https://github.com/angular/material2/commit/32eacd2))
* **rc6:** add directives for custom elements that are part of the APIs. ([#1121](https://github.com/angular/material2/issues/1121)) ([2c0dfcb](https://github.com/angular/material2/commit/2c0dfcb))
* **sidenav:** turn off view encapsulation and refactor css ([#1114](https://github.com/angular/material2/issues/1114)) ([97fe211](https://github.com/angular/material2/commit/97fe211))
* **tabs:** change missed md-active to md-tab-active ([#1044](https://github.com/angular/material2/issues/1044)) ([87b6193](https://github.com/angular/material2/commit/87b6193))

### Features

* **menu:** add keyboard events and improve accessibility ([#1132](https://github.com/angular/material2/issues/1132)) ([3669f06](https://github.com/angular/material2/commit/3669f06))
* **modules:** add `forRoot()` to material modules with providers ([#1122](https://github.com/angular/material2/issues/1122)) ([9ff6196](https://github.com/angular/material2/commit/9ff6196))
* **modules:** add `forRoot()` to all modules ([#1166](https://github.com/angular/material2/issues/1166)) ([21dc44a](https://github.com/angular/material2/commit/21dc44a))
* **overlay:** make overlays synchronous ([#1079](https://github.com/angular/material2/issues/1079)) ([cdad90b](https://github.com/angular/material2/commit/cdad90b))
* **slider:** add thumb-label ([#976](https://github.com/angular/material2/issues/976)) ([22d70ae](https://github.com/angular/material2/commit/22d70ae))
* **slider:** support ngModel ([#1029](https://github.com/angular/material2/issues/1029)) ([8828358](https://github.com/angular/material2/commit/8828358))
* **tabs:** support for `disabled` tabs ([#934](https://github.com/angular/material2/issues/934)) ([9d51deb](https://github.com/angular/material2/commit/9d51deb)), closes [#880](https://github.com/angular/material2/issues/880)

<a name="2.0.0-alpha.7"></a>
# [2.0.0-alpha.7 wax-umpire](https://github.com/angular/material2/compare/2.0.0-alpha.6...2.0.0-alpha.7) (2016-08-09)


### Bug Fixes

* **checkbox:** wrong cursor when disabled ([#908](https://github.com/angular/material2/issues/908)) ([5251c27](https://github.com/angular/material2/commit/5251c27)), closes [#907](https://github.com/angular/material2/issues/907)
* **checkbox, slide-toggle:** only emit change event if native input emitted one. ([#820](https://github.com/angular/material2/issues/820)) ([d52e6e0](https://github.com/angular/material2/commit/d52e6e0)), closes [#575](https://github.com/angular/material2/issues/575)
* **gestures:** custom recognizers should not inherit twice. ([#902](https://github.com/angular/material2/issues/902)) ([c68efbd](https://github.com/angular/material2/commit/c68efbd))
* **gestures:** ensure drag and pan are recognized with slide ([#901](https://github.com/angular/material2/issues/901)) ([3179fec](https://github.com/angular/material2/commit/3179fec))
* **input:** ensure all of label displays on safari ([#871](https://github.com/angular/material2/issues/871)) ([c8303b4](https://github.com/angular/material2/commit/c8303b4)), closes [#795](https://github.com/angular/material2/issues/795)
* **overlay:** lazily create container ([#894](https://github.com/angular/material2/issues/894)) ([1efbbb9](https://github.com/angular/material2/commit/1efbbb9))
* **progress-circle:** correct elapsed time calculation ([#927](https://github.com/angular/material2/issues/927)) ([0b17cd3](https://github.com/angular/material2/commit/0b17cd3)), closes [#926](https://github.com/angular/material2/issues/926)
* **progress-circle:** remove performance.now to support non browser envs ([#857](https://github.com/angular/material2/issues/857)) ([14c1765](https://github.com/angular/material2/commit/14c1765))
* **progress-circle:** remove references to window ([#838](https://github.com/angular/material2/issues/838)) ([66ddd3a](https://github.com/angular/material2/commit/66ddd3a)), closes [#837](https://github.com/angular/material2/issues/837)
* **radio:** only emit change event if native input does. ([#911](https://github.com/angular/material2/issues/911)) ([23a61ab](https://github.com/angular/material2/commit/23a61ab)), closes [#791](https://github.com/angular/material2/issues/791)
* **slide-toggle:** fix runtime exception for incorrect mousedown binding. ([#828](https://github.com/angular/material2/issues/828)) ([bbbc87f](https://github.com/angular/material2/commit/bbbc87f)), closes [#828](https://github.com/angular/material2/issues/828)
* fix type mismatches when offline compiling. ([#835](https://github.com/angular/material2/issues/835)) ([4bb7790](https://github.com/angular/material2/commit/4bb7790))


### Features

* Add NgModules ([#950](https://github.com/angular/material2/issues/950)) ([ca351b2](https://github.com/angular/material2/commit/ca351b2))

Note that NgModules are now the supported way of including the Material components in your app.
The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.8.


* **tooltip:** initial tooltip implementation ([#799](https://github.com/angular/material2/issues/799)) ([f5e2a81](https://github.com/angular/material2/commit/f5e2a81))
* **md-slider:** initial version for md-slider ([#779](https://github.com/angular/material2/issues/779)) ([8354750](https://github.com/angular/material2/commit/8354750))
* **md-menu** initial version for md-menu (more features coming in alpha.8) ([#893](https://github.com/angular/material2/issues/893)) ([16eb6be](https://github.com/angular/material2/commit/16eb6be)) ([#855](https://github.com/angular/material2/issues/855)) ([e324e47](https://github.com/angular/material2/commit/e324e47)) ([#867](https://github.com/angular/material2/issues/867)) ([9a32489](https://github.com/angular/material2/commit/9a32489))
* **ripple:** initial mdInkRipple implementation ([#681](https://github.com/angular/material2/issues/681)) ([47448cb](https://github.com/angular/material2/commit/47448cb))
* **button:** add ripple to md-button ([32aa461](https://github.com/angular/material2/commit/32aa461))
* **input:** support autocapitalize and autocorrect attributes ([#858](https://github.com/angular/material2/issues/858)) ([b2471f2](https://github.com/angular/material2/commit/b2471f2))
* **slide-toggle:** add drag functionality to thumb ([#750](https://github.com/angular/material2/issues/750)) ([25b4f21](https://github.com/angular/material2/commit/25b4f21))


### In-progress, not yet released
* **dialog:** add styles and ability to close. ([#862](https://github.com/angular/material2/issues/862)) ([758b851](https://github.com/angular/material2/commit/758b851))
* **dialog:** initial framework for md-dialog ([#761](https://github.com/angular/material2/issues/761)) ([9552ed5](https://github.com/angular/material2/commit/9552ed5))


### Code health
* **tabs:** adds e2e tests for tabs ([#650](https://github.com/angular/material2/issues/650)) ([3c74ae0](https://github.com/angular/material2/commit/3c74ae0)), closes [#549](https://github.com/angular/material2/issues/549)

### BREAKING CHANGES

* radio: radio-button will no longer emit change event on de-select.



<a name="2.0.0-alpha.6"></a>
# [2.0.0-alpha.6 carbonfiber-discotheque](https://github.com/angular/material2/compare/2.0.0-alpha.5...v2.0.0-alpha.6) (2016-06-30)
# [2.0.0-alpha.6 carbonfiber-discotheque](https://github.com/angular/material2/compare/2.0.0-alpha.5...2.0.0-alpha.6) (2016-06-30)

### Breaking changes
* `MdRadioDispatcher` is now `MdUniqueSelectionDispatcher` and is imported from `core`
@@ -59,7 +171,7 @@


<a name="2.0.0-alpha.5"></a>
# [2.0.0-alpha.5 granite-gouda](https://github.com/angular/material2/compare/2.0.0-alpha.4...v2.0.0-alpha.5) (2016-05-25)
# [2.0.0-alpha.5 granite-gouda](https://github.com/angular/material2/compare/2.0.0-alpha.4...2.0.0-alpha.5) (2016-05-25)


### Bug Fixes
@@ -101,7 +213,7 @@


<a name="2.0.0-alpha.4"></a>
# [2.0.0-alpha.4 mahogany-tambourine](https://github.com/angular/material2/compare/2.0.0-alpha.3...v2.0.0-alpha.4) (2016-05-04)
# [2.0.0-alpha.4 mahogany-tambourine](https://github.com/angular/material2/compare/2.0.0-alpha.3...2.0.0-alpha.4) (2016-05-04)


### Bug Fixes
@@ -125,7 +237,7 @@


<a name="2.0.0-alpha.3"></a>
# [2.0.0-alpha.3 cotton-candelabrum](https://github.com/angular/material2/compare/2.0.0-alpha.2...v2.0.0-alpha.3) (2016-04-21)
# [2.0.0-alpha.3 cotton-candelabrum](https://github.com/angular/material2/compare/2.0.0-alpha.2...2.0.0-alpha.3) (2016-04-21)


### Bug Fixes
@@ -147,7 +259,7 @@


<a name="2.0.0-alpha.2"></a>
# [2.0.0-alpha.2 diamond-haircut](https://github.com/angular/material2/compare/2.0.0-alpha.1...v2.0.0-alpha.2) (2016-04-06)
# [2.0.0-alpha.2 diamond-haircut](https://github.com/angular/material2/compare/2.0.0-alpha.1...2.0.0-alpha.2) (2016-04-06)


### Bug Fixes
@@ -180,7 +292,7 @@


<a name="2.0.0-alpha.1"></a>
# [2.0.0-alpha.1 nylon-hyperdrive](https://github.com/angular/material2/compare/2.0.0-alpha.0...v2.0.0-alpha.1) (2016-03-16)
# [2.0.0-alpha.1 nylon-hyperdrive](https://github.com/angular/material2/compare/2.0.0-alpha.0...2.0.0-alpha.1) (2016-03-16)


### Features
101 changes: 30 additions & 71 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -21,12 +21,14 @@ some initial config for the SystemJS module loader.
### Install Angular Material 2 components

Now that your project has been created, you can install any Angular Material 2 components you'd like
to use through npm. You can see our [list of published packages here](https://www.npmjs.com/~angular2-material).
to use through npm. You can see our [list of published packages here](https://www.npmjs.com/~angular2-material).

Note that only packages published under the `@latest` npm tag are officially released.

```bash
npm install --save @angular2-material/core @angular2-material/button @angular2-material/card
```
Note: the core module is required as a peer dependency of other components.
(the core module is required as a peer dependency of other components)

### Add components to vendor bundle

@@ -98,96 +100,53 @@ Now you should be able to import the components normally wherever you'd like to

**src/app/my-project.component.ts**
```ts
import { MD_CARD_DIRECTIVES } from '@angular2-material/card';
import { MD_BUTTON_DIRECTIVES } from '@angular2-material/button';
import { MdCardModule } from '@angular2-material/card';
import { MdButtonModule } from '@angular2-material/button';
```

And don't forget to add the directives to your directives array:
Import the components in your application module:

**src/app/my-project.component.ts**
**my-app-module.ts**
```ts
directives: [MD_CARD_DIRECTIVES, MD_BUTTON_DIRECTIVES]
@NgModule({
imports: [MdButtonModule, MdCardModule],
...
})
```

### Sample Angular Material 2 projects

- [Puppy Love (ng-conf 2016)](https://github.com/kara/puppy-love) - see live demo [here](https://youtu.be/rRiV_b3WsoY?t=4m20s)
- [Puppy Love Mobile (Google IO 2016)](https://github.com/kara/puppy-love-io)
- [Material 2 Sample App](https://github.com/jelbourn/material2-app)

### Additional steps for using Material components with forms

If you're using Angular Material 2 version alpha.6 or later, you'll need to upgrade to Angular 2's
new forms module. Here's how:
(the following are slightly out of date now)
- [Puppy Love (ng-conf 2016)](https://github.com/kara/puppy-love) - see live demo [here](https://youtu.be/rRiV_b3WsoY?t=4m20s)
- [Puppy Love Mobile (Google IO 2016)](https://github.com/kara/puppy-love-io)

- Install the `@angular/forms` package. If you're on Angular RC.4, install version 0.2.0.

```bash
npm install @angular/forms
### Additional setup for `md-menu` and `md-tooltip`:
For alpha.7, you need to include the overlay styles in your app via a `link` element. This will
look something like
```html
<link href="vendor/@angular2-material/core/overlay/overlay.css" rel="stylesheet">
```

- Change your bootstrap file to disable the old form directives and provide the new form
directives.
In future releases, all of the core styles will be combined into a single distributed css file.

**main.ts**
```ts
import {disableDeprecatedForms, provideForms} from '@angular/forms';

bootstrap(MyAppComponent, [
disableDeprecatedForms(),
provideForms()
]);
```
### Additional setup for `md-slide-toggle` and `md-slider`:
The slide-toggle and slider components have a dependency on [HammerJS](http://hammerjs.github.io/).
1) Add HammerJS to your application via [npm](https://www.npmjs.com/package/hammerjs), a CDN
(such as the [Google CDN](https://developers.google.com/speed/libraries/#hammerjs)),
or served directly from your app.
2) Include the typings for HammerJS in your typescript build ([more info on @types](https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files))

- Import any and all forms symbols - `NgForm`, `Validators`, etc - from `@angular/forms`.
Importing them from `@angular/common` will result in a `No value accessor found` error.

- Update your form code to use the new APIs. See more information about the changes in the proposal
doc [here](https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub)
and the official documentation [here](https://angular.io/docs/ts/latest/guide/forms.html).
### Additional setup for `md-icon`:

### Additional steps for `md-icon` setup:

- If you want to use Material Design icons, load the Material Design font in your `index.html`. `md-icon` supports any font icons or svg icons,
so this is only one potential option.
- If you want to use Material Design icons, load the Material Design font in your `index.html`.
`md-icon` supports any font icons or svg icons, so this is only one potential option.

**src/index.html**
```html
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
```
- Include http providers in your `main.ts`:

**src/main.ts**
```ts
import { HTTP_PROVIDERS } from '@angular/http';
...
bootstrap(MyAppComponent, [
HTTP_PROVIDERS
]);
```

- Provide the icon registry at or above the component where you're using the icon:

**src/app/my-project.component.ts**
```ts
import {MdIcon, MdIconRegistry} from '@angular2-material/icon';
...
directives: [MD_CARD_DIRECTIVES, MD_BUTTON_DIRECTIVES, MdIcon],
providers: [MdIconRegistry]
```

- Add the icon package to the list of Material components in your `system-config.ts`:

**src/system-config.ts**
```ts
// put the names of any of your Material components here
const materialPkgs:string[] = [
...
'icon'
];
```




124 changes: 110 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,26 +5,122 @@

This is the home for the Angular team's Material Design components built on top of Angular 2.

### Project status
The alpha has begun! See the [changelog](CHANGELOG.md) for more information.
#### Quick links
[Google group](https://groups.google.com/forum/#!forum/angular-material2),
[Contributing](https://github.com/angular/material2/blob/master/CONTRIBUTING.md),
[Plunker Template](http://plnkr.co/edit/o077B6uEiiIgkC0S06dd?p=preview)

You also might want to check out our [Getting Started Guide](https://github.com/angular/material2/blob/master/GETTING_STARTED.md) if you're
building your first project with Angular Material 2.
### Getting started

See our [Getting Started Guide](https://github.com/angular/material2/blob/master/GETTING_STARTED.md)
if you're building your first project with Angular Material 2.

### Project status
Angular Material 2 is currently in alpha and under active development.
During alpha, breaking API and behavior changes will be occurring regularly.

Check out our [directory of design documents](https://github.com/angular/material2/wiki/Design-doc-directory) for more insight into our process.
Check out our [directory of design documents](https://github.com/angular/material2/wiki/Design-doc-directory)
for more insight into our process.

We are still getting our CI infrastructure (tests, lint etc.) set up, as well as building out
the core library pieces that components will be built upon. If you'd like to contribute,
please look through the issues (which should be up-to-date on who is working on which features and
which pieces are blocked) and make a comment.
Also see our [`Good for community contribution`](https://github.com/angular/material2/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+for+community+contribution%22) label.
If you'd like to contribute, you must follow our [contributing guidelines](https://github.com/angular/material2/blob/master/CONTRIBUTING.md).
You can look through the issues (which should be up-to-date on who is working on which features
and which pieces are blocked) and make a comment.
Also see our [`Good for community contribution`](https://github.com/angular/material2/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+for+community+contribution%22)
label.

#### Quick links
[Google group](https://groups.google.com/forum/#!forum/angular-material2),
[Contributing](https://github.com/angular/material2/blob/master/CONTRIBUTING.md),
[Plunker Template](http://plnkr.co/edit/o077B6uEiiIgkC0S06dd?p=preview)
High level items planned for September 2016:
* Work on Angular core towards 2.0.0 final
* Preparing for conferences (Angular Connect and ng-europe)
* Final features for dialog
* Initial version of snackbar.
* Additional behaviors for menu, start design for select.
* Finalize high-level design details for data-table.


#### Feature status:

| Feature | Status | Docs | Issue |
|------------------|-------------------------------------|--------------|----------------|
| button | Available | [README][1] | - |
| cards | Available | [README][2] | - |
| checkbox | Available | [README][3] | - |
| radio | Available | [README][4] | - |
| input | Available | [README][5] | - |
| sidenav | Available | [README][6] | - |
| toolbar | Available | [README][7] | - |
| list | Available | [README][8] | [#107][0107] |
| grid-list | Available | [README][9] | - |
| icon | Available | [README][10] | - |
| progress-circle | Available | [README][11] | - |
| progress-bar | Available | [README][12] | - |
| tabs | Available | [README][13] | - |
| slide-toggle | Available | [README][14] | - |
| button-toggle | Available | [README][15] | - |
| slider | Available | [README][16] | - |
| menu | Initial version, needs enhancements | [README][17] | [#119][0119] |
| tooltip | Initial version, needs enhancements | [README][18] | - |
| ripples | Available, but needs to be applied | [README][19] | [#108][0108] |
| dialog | Started, not yet ready for release | - | [#114][0114] |
| snackbar / toast | Proof-of-concept | - | [#115][0115] |
| select | Not started | - | [#118][0118] |
| textarea | Not started | - | [#546][0546] |
| autocomplete | Not started | - | [#117][0117] |
| chips | Not started | - | [#120][0120] |
| theming | Designed, no code yet | - | [#123][0123] |
| prod build | Not started | - | - |
| docs site | UX design and tooling in progress | - | - |
| typography | Not started | - | [#205][0205] |
| layout | Not started | - | - |
| fab speed-dial | Not started | - | [#860][0860] |
| fab toolbar | Not started | - | - |
| bottom-sheet | Not started | - | - |
| bottom-nav | Not started | - | [#408][0408] |
| virtual-repeat | Not started | - | [#823][0823] |
| datepicker | Not started | - | [#675][0675] |
| data-table | Not started | - | [#581][0581] |
| stepper | Not started | - | [#508][0508] |

[1]: https://github.com/angular/material2/blob/master/src/lib/button/README.md
[2]: https://github.com/angular/material2/blob/master/src/lib/card/README.md
[3]: https://github.com/angular/material2/blob/master/src/lib/checkbox/README.md
[4]: https://github.com/angular/material2/blob/master/src/lib/radio/README.md
[5]: https://github.com/angular/material2/blob/master/src/lib/input/README.md
[6]: https://github.com/angular/material2/blob/master/src/lib/sidenav/README.md
[7]: https://github.com/angular/material2/blob/master/src/lib/toolbar/README.md
[8]: https://github.com/angular/material2/blob/master/src/lib/list/README.md
[9]: https://github.com/angular/material2/blob/master/src/lib/grid-list/README.md
[10]: https://github.com/angular/material2/blob/master/src/lib/icon/README.md
[11]: https://github.com/angular/material2/blob/master/src/lib/progress-circle/README.md
[12]: https://github.com/angular/material2/blob/master/src/lib/progress-bar/README.md
[13]: https://github.com/angular/material2/blob/master/src/lib/tabs/README.md
[14]: https://github.com/angular/material2/blob/master/src/lib/slide-toggle/README.md
[15]: https://github.com/angular/material2/blob/master/src/lib/button-toggle/README.md
[16]: https://github.com/angular/material2/blob/master/src/lib/slider/README.md
[17]: https://github.com/angular/material2/blob/master/src/lib/menu/README.md
[18]: https://github.com/angular/material2/blob/master/src/lib/tooltip/README.md
[19]: https://github.com/angular/material2/blob/master/src/lib/core/ripple/README.md

[0107]: https://github.com/angular/material2/issues/107
[0119]: https://github.com/angular/material2/issues/119
[0108]: https://github.com/angular/material2/issues/108
[0114]: https://github.com/angular/material2/issues/114
[0115]: https://github.com/angular/material2/issues/115
[0118]: https://github.com/angular/material2/issues/118
[0546]: https://github.com/angular/material2/issues/546
[0117]: https://github.com/angular/material2/issues/117
[0120]: https://github.com/angular/material2/issues/120
[0123]: https://github.com/angular/material2/issues/123
[0205]: https://github.com/angular/material2/issues/205
[0860]: https://github.com/angular/material2/issues/860
[0408]: https://github.com/angular/material2/issues/408
[0508]: https://github.com/angular/material2/issues/508
[0823]: https://github.com/angular/material2/issues/823
[0675]: https://github.com/angular/material2/issues/675
[0581]: https://github.com/angular/material2/issues/581


"Available" means that the components or feature is published and available for use, but may still
be missing some behaviors or polish.

## The goal of Angular Material
Our goal is to build a set of high-quality UI components built with Angular 2 and TypeScript,
111 changes: 0 additions & 111 deletions angular-cli-build.js

This file was deleted.

25 changes: 0 additions & 25 deletions angular-cli.json

This file was deleted.

13 changes: 13 additions & 0 deletions e2e/components/menu/menu-page.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ export class MenuPage {

menu() { return element(by.css('.md-menu')); }

start() { return element(by.id('start')); }

trigger() { return element(by.id('trigger')); }

triggerTwo() { return element(by.id('trigger-two')); }
@@ -32,6 +34,17 @@ export class MenuPage {

combinedMenu() { return element(by.css('.md-menu.combined')); }

// TODO(kara): move to common testing utility
pressKey(key: any): void {
browser.actions().sendKeys(key).perform();
}

// TODO(kara): move to common testing utility
expectFocusOn(el: ElementFinder): void {
expect(browser.driver.switchTo().activeElement().getInnerHtml())
.toBe(el.getInnerHtml());
}

expectMenuPresent(expected: boolean) {
return browser.isElementPresent(by.css('.md-menu')).then((isPresent) => {
expect(isPresent).toBe(expected);
84 changes: 81 additions & 3 deletions e2e/components/menu/menu.e2e.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ describe('menu', () => {
page.trigger().click();

page.expectMenuPresent(true);
expect(page.menu().getText()).toEqual("One\nTwo\nThree");
expect(page.menu().getText()).toEqual("One\nTwo\nThree\nFour");
});

it('should close menu when area outside menu is clicked', () => {
@@ -45,14 +45,14 @@ describe('menu', () => {

it('should support multiple triggers opening the same menu', () => {
page.triggerTwo().click();
expect(page.menu().getText()).toEqual("One\nTwo\nThree");
expect(page.menu().getText()).toEqual("One\nTwo\nThree\nFour");
page.expectMenuAlignedWith(page.menu(), 'trigger-two');

page.body().click();
page.expectMenuPresent(false);

page.trigger().click();
expect(page.menu().getText()).toEqual("One\nTwo\nThree");
expect(page.menu().getText()).toEqual("One\nTwo\nThree\nFour");
page.expectMenuAlignedWith(page.menu(), 'trigger');

page.body().click();
@@ -66,6 +66,84 @@ describe('menu', () => {
});
});

describe('keyboard events', () => {
beforeEach(() => {
// click start button to avoid tabbing past navigation
page.start().click();
page.pressKey(protractor.Key.TAB);
});

it('should auto-focus the first item when opened with keyboard', () => {
page.pressKey(protractor.Key.ENTER);
page.expectFocusOn(page.items(0));
});

it('should not focus the first item when opened with mouse', () => {
page.trigger().click();
page.expectFocusOn(page.trigger());
});

it('should focus subsequent items when down arrow is pressed', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.DOWN);
page.expectFocusOn(page.items(1));
});

it('should focus previous items when up arrow is pressed', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.DOWN);
page.pressKey(protractor.Key.UP);
page.expectFocusOn(page.items(0));
});

it('should skip disabled items using arrow keys', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.DOWN);
page.pressKey(protractor.Key.DOWN);
page.expectFocusOn(page.items(3));

page.pressKey(protractor.Key.UP);
page.expectFocusOn(page.items(1));
});

it('should close the menu when tabbing past items', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.TAB);
page.expectMenuPresent(false);

page.start().click();
page.pressKey(protractor.Key.TAB);
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB));
page.expectMenuPresent(false);
});

it('should wrap back to menu when arrow keying past items', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.DOWN);
page.pressKey(protractor.Key.DOWN);
page.pressKey(protractor.Key.DOWN);
page.expectFocusOn(page.items(0));

page.pressKey(protractor.Key.UP);
page.expectFocusOn(page.items(3));
});

it('should focus before and after trigger when tabbing past items', () => {
page.pressKey(protractor.Key.ENTER);
page.pressKey(protractor.Key.TAB);
page.expectFocusOn(page.triggerTwo());

// navigate back to trigger
page.pressKey(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB));
page.pressKey(protractor.Key.ENTER);

page.pressKey(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB));
page.expectFocusOn(page.start());
});

});

describe('position - ', () => {

it('should default menu alignment to "after below" when not set', () => {
2 changes: 1 addition & 1 deletion e2e/components/tabs/tabs.e2e.ts
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ function getFocusStates(elements: ElementArrayFinder) {
* @returns {webdriver.promise.Promise<Promise<boolean>[]>|webdriver.promise.Promise<T[]>}
*/
function getActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-active');
return getClassStates(elements, 'md-tab-active');
}

/**
14 changes: 14 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
/**
* Load the TypeScript compiler, then load the TypeScript gulpfile which simply loads all
* the tasks. The tasks are really inside tools/gulp/tasks.
*/

const path = require('path');

// Register TS compilation.
require('ts-node').register({
project: path.join(__dirname, 'tools/gulp')
});

require('./tools/gulp/gulpfile');
71 changes: 40 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -8,65 +8,74 @@
"url": "https://github.com/angular/material2.git"
},
"scripts": {
"ci:forbidden-identifiers": "node ./scripts/ci/forbidden-identifiers.js",
"build": "ng build",
"demo-app": "ng serve",
"test": "karma start test/karma.conf.js",
"tslint": "tslint -c tslint.json 'src/**/*.ts'",
"stylelint": "stylelint 'src/**/*.scss' --config stylelint-config.json --syntax scss",
"check-circular-deps": "madge --circular ./dist",
"typings": "typings install --global",
"postinstall": "npm run typings",
"e2e": "protractor",
"inline-resources": "node ./scripts/release/inline-resources.js ./dist/components",
"build": "gulp build",
"demo-app": "gulp serve:devapp",
"test": "gulp test",
"tslint": "gulp lint",
"stylelint": "gulp lint",
"e2e": "gulp e2e",
"deploy": "firebase deploy",
"webdriver-manager": "webdriver-manager"
},
"version": "2.0.0-alpha.6-2",
"version": "2.0.0-alpha.8-1",
"license": "MIT",
"engines": {
"node": ">= 4.2.1 < 5"
},
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "v3.0.0-alpha.8",
"@angular/forms": "^0.2.0",
"core-js": "^2.4.0",
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "5.0.0-beta.6",
"rxjs": "5.0.0-beta.11",
"systemjs": "0.19.31",
"zone.js": "0.6.12"
"zone.js": "0.6.17"
},
"devDependencies": {
"@angular/compiler-cli": "^0.4.1",
"add-stream": "^1.0.0",
"angular-cli": "^1.0.0-beta.9",
"broccoli-autoprefixer": "^4.1.0",
"broccoli-funnel": "^1.0.1",
"broccoli-merge-trees": "^1.1.1",
"@angular/compiler-cli": "0.6.0",
"@types/glob": "^5.0.29",
"@types/gulp": "^3.8.29",
"@types/hammerjs": "^2.0.30",
"@types/jasmine": "^2.2.31",
"@types/merge2": "0.0.28",
"@types/minimist": "^1.1.28",
"@types/node": "^6.0.34",
"@types/run-sequence": "0.0.27",
"browserstacktunnel-wrapper": "^1.4.2",
"conventional-changelog": "^1.1.0",
"ember-cli-inject-live-reload": "^1.4.0",
"express": "^4.14.0",
"firebase-tools": "^2.2.1",
"fs-extra": "^0.26.5",
"glob": "^6.0.4",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-sass": "^2.3.2",
"gulp-server-livereload": "^1.8.2",
"gulp-shell": "^0.5.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.13.6",
"jasmine-core": "^2.4.1",
"js-yaml": "^3.5.2",
"karma": "^1.1.1",
"karma-browserstack-launcher": "^1.0.1",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-sauce-launcher": "^1.0.0",
"madge": "^0.6.0",
"merge2": "^1.0.2",
"minimist": "^1.2.0",
"node-sass": "^3.4.2",
"protractor": "^3.3.0",
"protractor-accessibility-plugin": "0.1.1",
"resolve-bin": "^0.4.0",
"rollup": "^0.34.13",
"run-sequence": "^1.2.2",
"sass": "^0.5.0",
"strip-ansi": "^3.0.0",
"stylelint": "^6.9.0",
38 changes: 4 additions & 34 deletions scripts/ci/build-and-test.sh
Original file line number Diff line number Diff line change
@@ -14,42 +14,12 @@ start_tunnel

wait_for_tunnel
if is_lint; then
npm run tslint
npm run ci:forbidden-identifiers
npm run stylelint
elif is_circular_deps_check; then
# Build first because madge needs the JavaScript output.
ng build
npm run check-circular-deps
$(npm bin)/gulp ci:lint
elif is_e2e; then
# Start up the e2e app. This will take some time.
echo "Starting e2e app"
MD_APP=e2e ng serve &
sleep 1

# Wait until the dist/ directory is created, indicating that the e2e app is ready.
# Use the presence of `button.js` to determine whether the compiled output is ready to be served.
echo "Waiting for e2e app to start"
while [ ! -f ./dist/components/button/button.js ]; do
sleep 2
echo -n ".."
done

echo "\nInlining resources"
npm run inline-resources

# Run the e2e tests on the served e2e app.
echo "Starting e2e tests"
ng e2e
$(npm bin)/gulp ci:e2e
elif is_extract_metadata; then
# Run `tsc` first so that the directory structure in dist/ matches what ngc expects.
./node_modules/.bin/tsc -p ./src/demo-app/
./node_modules/.bin/ngc -p ./src/demo-app/
$(npm bin)/gulp ci:extract-metadata
else
# Unit tests
npm run build
npm run inline-resources

karma start test/karma.conf.js --single-run --no-auto-watch --reporters='dots'
$(npm bin)/gulp ci:test
fi
teardown_tunnel
285 changes: 144 additions & 141 deletions scripts/ci/forbidden-identifiers.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
#!/usr/bin/env node

'use strict';

/*
* This script analyzes the current commits of the CI.
* It will search for blocked statements, which have been added in the commits and fail if present.
* The forbidden identifiers script will check for blocked statements and also detect invalid
* imports of other scope packages.
*
* When running against a PR, the script will only analyze the specific amount of commits inside
* of the Pull Request.
*
* By default it checks all source files and fail if any errors were found.
*/

const child_process = require('child_process');
const fs = require('fs');
const path = require('path');

const exec = function(cmd) {
return new Promise(function(resolve, reject) {
child_process.exec(cmd, function(err, stdout /*, stderr */) {
if (err) {
reject(err);
} else {
resolve(stdout);
}
});
});
};

const glob = require('glob').sync;

const blocked_statements = [
'\\bddescribe\\(',
@@ -34,64 +28,123 @@ const blocked_statements = [
'from \\\'rxjs/Rx\\\'',
];

// Retrieves all scope packages dynamically from the source.
// Developers shouldn't be able to import from other scope packages by using relative paths.
const componentFolders = fs
.readdirSync(`${__dirname}/../../src/components`)
.map(componentName => `src/components/${componentName}`);

const scopePackages = ['src/core'].concat(componentFolders);

const sourceFolders = ['./src', './e2e'];
const scopePackages = glob('src/lib/*');
const blockedRegex = new RegExp(blocked_statements.join('|'), 'g');
const importRegex = /from\s+'(.*)';/g;

/**
* Find the fork point between HEAD of the current branch, and master.
* @return {Promise<string>} A promise which resolves with the fork SHA (or reject).
/*
* Verify that the current PR is not adding any forbidden identifiers.
* Run the forbidden identifiers check against all sources when not verifying a PR.
*/
function findForkPoint() {
return exec('git merge-base --fork-point HEAD master')
.then(function(stdout) {
return stdout.split('\n')[0];
});
}

findTestFiles()

/* Only match .js or .ts, and remove .d.ts files. */
.then(files => files.filter(name => /\.(js|ts)$/.test(name) && !/\.d\.ts$/.test(name)))

/* Read content of the filtered files */
.then(files => files.map(name => ({ name, content: fs.readFileSync(name, 'utf-8') })))

/* Run checks against content of the filtered files. */
.then(diffList => {

return diffList.reduce((errors, diffFile) => {
let fileName = diffFile.name;
let content = diffFile.content.split('\n');
let lineCount = 0;

content.forEach(line => {
lineCount++;

let matches = line.match(blockedRegex);
let scopeImport = isRelativeScopeImport(fileName, line);

if (matches || scopeImport) {

let error = {
fileName: fileName,
lineNumber: lineCount,
statement: matches && matches[0] || scopeImport.invalidStatement
};

if (scopeImport) {
error.messages = [
'You are using an import statement, which imports a file from another scope package.',
`Please import the file by using the following path: ${scopeImport.scopeImportPath}`
];
}

errors.push(error);
}
});

return errors;

}, []);
})

/* Print the resolved errors to the console */
.then(errors => {
if (errors.length > 0) {
console.error('Error: You are using one or more blocked statements:\n');

errors.forEach(entry => {
if (entry.messages) {
entry.messages.forEach(message => console.error(` ${message}`))
}

console.error(` ${entry.fileName}@${entry.lineNumber}, Statement: ${entry.statement}.\n`);
});

process.exit(1);
}
})

.catch(err => {
// An error occurred in this script. Output the error and the stack.
console.error('An error occurred during execution:');
console.error(err.stack || err);
process.exit(2);
});


/**
* Get the commit range to evaluate when this script is run.
* @return {Promise<string>} A commit range of the form ref1...ref2.
* Resolves all files, which should run against the forbidden identifiers check.
* @return {Promise.<Array.<string>>} Files to be checked.
*/
function getCommitRange() {
if (process.env['TRAVIS_COMMIT_RANGE']) {
return Promise.resolve(process.env['TRAVIS_COMMIT_RANGE']);
} else {
return findForkPoint().then((forkPointSha) => `${forkPointSha}...HEAD`);
function findTestFiles() {
if (process.env['TRAVIS_PULL_REQUEST']) {
return findChangedFiles();
}

var files = sourceFolders.map(folder => {
return glob(`${folder}/**/*.ts`);
}).reduce((files, fileSet) => files.concat(fileSet), []);

return Promise.resolve(files);
}

/**
* List all the files that have been changed or added in the last commit range.
* @returns {Promise<Array<string>>} Resolves with a list of files that are
* added or changed.
* @returns {Promise.<Array.<string>>} Resolves with a list of files that are added or changed.
*/
function findChangedFiles() {
return getCommitRange()
.then(range => {
return exec(`git diff --name-status ${range} ./src ./e2e`);
})
let commitRange = process.env['TRAVIS_COMMIT_RANGE'];

return exec(`git diff --name-status ${commitRange} ${sourceFolders.join(' ')}`)
.then(rawDiff => {
// Ignore deleted files.
return rawDiff.split('\n')
.filter(function(line) {
// Status: C## => Copied (##% confident)
// R## => Renamed (##% confident)
// D => Deleted
// M => Modified
// A => Added
return line.match(/([CR][0-9]*|[AM])\s+/);
})
.map(function(line) {
return line.split(/\s+/, 2)[1];
});
return rawDiff
.split('\n')
.filter(line => {
// Status: C## => Copied (##% confident)
// R## => Renamed (##% confident)
// D => Deleted
// M => Modified
// A => Added
return line.match(/([CR][0-9]*|[AM])\s+/);
})
.map(line => line.split(/\s+/, 2)[1]);
});
}

@@ -125,103 +178,53 @@ function isRelativeScopeImport(fileName, line) {
// Transform the relative import path into an absolute path.
importPath = path.resolve(path.dirname(fileName), importPath);

let currentScope = findScope(fileName);
let fileScope = findScope(fileName);
let importScope = findScope(importPath);

if (currentScope !== importScope) {
// Transforms the invalid import statement into a correct import statement, which uses the scope package.
let scopeImport = `@angular2-material/${path.basename(importScope)}/${path.relative(importScope, importPath)}`;
if (fileScope.path !== importScope.path) {

// Creates a valid import statement, which uses the correct scope package.
let importFilePath = path.relative(importScope.path, importPath);
let validImportPath = `@angular2-material/${importScope.name}/${importFilePath}`;

return {
currentScope: currentScope,
importScope: importScope,
fileScope: fileScope.name,
importScope: importScope.name,
invalidStatement: importMatch[0],
scopeImportPath: scopeImport
scopeImportPath: validImportPath
}
}

return false;

function findScope(filePath) {
// Normalize the filePath as well, to avoid issues with the different environments path delimiter.
// Normalize the filePath, to avoid issues with the different environments path delimiter.
filePath = path.normalize(filePath);

// Iterate through all scopes and try to find them inside of the file path.
return scopePackages.filter(scope => filePath.indexOf(path.normalize(scope)) !== -1).pop();
// Iterate through all scope paths and try to find them inside of the file path.
var scopePath = scopePackages
.filter(scope => filePath.indexOf(path.normalize(scope)) !== -1)
.pop();

// Return an object containing the name of the scope and the associated path.
return {
name: path.basename(scopePath),
path: scopePath
}
}

}


// Find all files, check for errors, and output every errors found.
findChangedFiles()
.then(fileList => {
// Only match .js or .ts, and remove .d.ts files.
return fileList.filter(function(name) {
return name.match(/\.[jt]s$/) && !name.match(/\.d\.ts$/);
/**
* Executes a process command and wraps it inside of a promise.
* @returns {Promise.<String>}
*/
function exec(cmd) {
return new Promise(function(resolve, reject) {
child_process.exec(cmd, function(err, stdout /*, stderr */) {
if (err) {
reject(err);
} else {
resolve(stdout);
}
});
})
.then(fileList => {
// Read every file and return a Promise that will contain an array of
// Object of the form { fileName, content }.
return Promise.all(fileList.map(function(fileName) {
return {
fileName: fileName,
content: fs.readFileSync(fileName, { encoding: 'utf-8' })
};
}));
})
.then(diffList => {
// Reduce the diffList to an array of errors. The array will be empty if no errors
// were found.
return diffList.reduce((errors, diffEntry) => {
let fileName = diffEntry.fileName;
let content = diffEntry.content.split('\n');
let ln = 0;

// Get all the lines that start with `+`.
content.forEach(function(line) {
ln++;

let matches = line.match(blockedRegex);
let isScopeImport = isRelativeScopeImport(fileName, line);

if (matches || isScopeImport) {
// Accumulate all errors at once.
let error = {
fileName: fileName,
lineNumber: ln,
statement: matches && matches[0] || isScopeImport.invalidStatement
};

if (isScopeImport) {
error.message =
' You are using an import statement, which imports a file from another scope package.\n' +
` Please import the file by using the following path: ${isScopeImport.scopeImportPath}`;
}

errors.push(error);
}
});
return errors;
}, []);
})
.then(errors => {
if (errors.length > 0) {
console.error('Error: You are using a statement in your commit, which is not allowed.\n');

errors.forEach(entry => {
if (entry.message) console.error(entry.message);
console.error(` ${entry.fileName}@${entry.lineNumber}, Statement: ${entry.statement}.\n`);
});

process.exit(1);
}
})
.catch(err => {
// An error occured in this script. Output the error and the stack.
console.error('An error occured during execution:');
console.error(err);
console.error(err.stack);
process.exit(2);
});
}
4 changes: 0 additions & 4 deletions scripts/ci/sources/mode.sh
Original file line number Diff line number Diff line change
@@ -9,10 +9,6 @@ is_lint() {
[[ "$MODE" = lint ]]
}

is_circular_deps_check() {
[[ "$MODE" = circular_deps ]]
}

is_extract_metadata() {
[[ "$MODE" = extract_metadata ]]
}
38 changes: 31 additions & 7 deletions scripts/release/changelog.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#!/usr/bin/env node

'use strict';
/**

/*
* Creates a conventional changelog from the current git repository / metadata.
*/

var fs = require('fs');
var addStream = require('add-stream');
var cl = require('conventional-changelog');
var inStream = fs.createReadStream('CHANGELOG.md');
const fs = require('fs');
const addStream = require('add-stream');
const changelog = require('conventional-changelog');
const spawnSync = require('child_process').spawnSync;
const npmVersion = require('../../package.json').version;

/**
* When the command line argument `--force` is provided, then the full changelog will created and overwritten.
* By default, it will only create the changelog from the latest tag to head and prepends it to the changelog.
*/
var isForce = process.argv.indexOf('--force') !== -1;
const isForce = process.argv.indexOf('--force') !== -1;
const inStream = fs.createReadStream('CHANGELOG.md');
const gitTags = getAvailableTags();

// Whether the npm version is later than the most recent tag.
const isNpmLatest = npmVersion !== gitTags[0];
// When the npm version is the latest, use the npm version, otherwise use the latest tag.
const currentTag = isNpmLatest ? npmVersion : gitTags[0];
// When the npm version is the latest use the most recent tag. Otherwise use the previous tag.
const previousTag = isNpmLatest ? gitTags[0] : gitTags[1];

inStream.on('error', function(err) {
console.error('An error occurred, while reading the previous changelog file.\n' +
@@ -28,7 +39,12 @@ var config = {
releaseCount: isForce ? 0 : 1
};

var stream = cl(config)
var context = {
currentTag: currentTag,
previousTag: previousTag
};

var stream = changelog(config, context)
.on('error', function(err) {
console.error('An error occurred while generating the changelog: ' + err);
})
@@ -45,3 +61,11 @@ if (!isForce) {
function getOutputStream() {
return fs.createWriteStream('CHANGELOG.md');
}

/**
* Resolves available tags over all branches from the repository metadata.
* @returns {Array.<String>} Array of available tags.
*/
function getAvailableTags() {
return spawnSync('git', ['tag']).stdout.toString().trim().split('\n').reverse();
}
61 changes: 41 additions & 20 deletions scripts/release/inline-resources.js
Original file line number Diff line number Diff line change
@@ -29,28 +29,35 @@ const readFile = promiseify(fs.readFile);
const writeFile = promiseify(fs.writeFile);


/**
* For every argument, inline the templates and styles under it and write the new file.
*/
for (let arg of process.argv.slice(2)) {
if (arg.indexOf('*') < 0) {
// Argument is a directory target, add glob patterns to include every files.
arg = path.join(arg, '**', '*');
function inlineResources(globs) {
/**
* For every argument, inline the templates and styles under it and write the new file.
*/
for (let pattern of globs) {
if (pattern.indexOf('*') < 0) {
// Argument is a directory target, add glob patterns to include every files.
pattern = path.join(pattern, '**', '*');
}

const files = glob.sync(pattern, {})
.filter(name => /\.js$/.test(name)); // Matches only JavaScript files.

// Generate all files content with inlined templates.
files.forEach(filePath => {
readFile(filePath, 'utf-8')
.then(content => inlineTemplate(filePath, content))
.then(content => inlineStyle(filePath, content))
.then(content => removeModuleId(filePath, content))
.then(content => writeFile(filePath, content))
.catch(err => {
console.error('An error occured: ', err);
});
});
}
}

const files = glob.sync(arg, {})
.filter(name => /\.js$/.test(name)); // Matches only JavaScript files.

// Generate all files content with inlined templates.
files.forEach(filePath => {
readFile(filePath, 'utf-8')
.then(content => inlineTemplate(filePath, content))
.then(content => inlineStyle(filePath, content))
.then(content => writeFile(filePath, content))
.catch(err => {
console.error('An error occured: ', err);
});
});
if (require.main === module) {
inlineResources(process.argv.slice(2));
}


@@ -96,3 +103,17 @@ function inlineStyle(filePath, content) {
+ ']';
});
}


/**
* Remove every mention of `moduleId: module.id`.
* @param _ {string} The file path of the source file, currently ignored.
* @param content {string} The source file's content.
* @returns {string} The content with all moduleId: mentions removed.
*/
function removeModuleId(_, content) {
return content.replace(/\s*moduleId:\s*module\.id\s*,?\s*/gm, '');
}


module.exports = inlineResources;
28 changes: 0 additions & 28 deletions scripts/release/stage-release.bat

This file was deleted.

66 changes: 0 additions & 66 deletions scripts/release/stage-release.sh

This file was deleted.

154 changes: 0 additions & 154 deletions src/components/button/button.spec.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/card/card.html

This file was deleted.

86 changes: 0 additions & 86 deletions src/components/dialog/dialog-container.ts

This file was deleted.

155 changes: 0 additions & 155 deletions src/components/dialog/dialog.spec.ts

This file was deleted.

406 changes: 0 additions & 406 deletions src/components/grid-list/grid-list.spec.ts

This file was deleted.

445 changes: 0 additions & 445 deletions src/components/icon/icon.spec.ts

This file was deleted.

923 changes: 0 additions & 923 deletions src/components/input/input.spec.ts

This file was deleted.

180 changes: 0 additions & 180 deletions src/components/list/list.spec.ts

This file was deleted.

85 changes: 0 additions & 85 deletions src/components/menu/menu-directive.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/components/menu/menu.spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/menu/menu.ts

This file was deleted.

124 changes: 0 additions & 124 deletions src/components/progress-bar/progress-bar.spec.ts

This file was deleted.

125 changes: 0 additions & 125 deletions src/components/progress-circle/progress-circle.spec.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/sidenav/sidenav-transitions.scss

This file was deleted.

269 changes: 0 additions & 269 deletions src/components/slider/slider.ts

This file was deleted.

53 changes: 0 additions & 53 deletions src/components/toolbar/toolbar.spec.ts

This file was deleted.

104 changes: 0 additions & 104 deletions src/components/tooltip/tooltip.spec.ts

This file was deleted.

140 changes: 0 additions & 140 deletions src/core/a11y/live-announcer.spec.ts

This file was deleted.

46 changes: 0 additions & 46 deletions src/core/core.ts

This file was deleted.

181 changes: 0 additions & 181 deletions src/core/overlay/overlay.spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/demo-app/baseline/baseline-demo.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import 'default-theme';
@import 'variables';

.demo-basic {
padding: 0;
@@ -18,13 +16,6 @@
width: inherit;
}

.demo-transform {
transition: color $swift-ease-out-duration $swift-ease-out-timing-function;
}
.demo-primary {
color: md-color($md-primary);
}

.demo-card {
margin: 16px;
}
Loading