Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
feat(angular2): update to 2.0.x and latest @angular/material
Browse files Browse the repository at this point in the history
* dev: Setup for VS Code

I needed some config changes for my developer setup on windows.

* Update dependencies

Update dependencies to @angular rc.5 and @angular2-material to alpha.7-4

* dev: Drop tests

Remove tests from build to simplify upgrade. Testing using our own example app.

* Remove modules to be replaced

Removing modules that were recommended to be superceeded by their @angular2-material counterparts in [this gist] (https://gist.github.com/ollwenjones/d33b181773d8c8d7f4293cf6e6c4005b) by @ollwenjones

Leaving scss for our example app.

* Pagination NgModule class and Pagination bugfixes

Created Pagination NgModule class and corrected TS compiler and Angular errors.

* Created MdContentModule

Created NgModule for MdContent directive

* Created MdDataTableModule

Created NgModule class for MdDataTable

* Created MdDividerModule

Created NgModule class for MdDivider

* Created MdPeekabooModule

Created NgModule class for MdPeekaboo

* Created MdValidatorModule

Created NgModule class for Md* validator directives

* Created MdSubheaderModule

Created NgModule class for MdSubheader

* Created MdBackdropModule

Created NgModule class for MdBackdrop

* Created Ng2MaterialModule and Ng2MaterialNodeModule

Create NgModule classes for ng2-material in Node.js and browser.
Removed exports from deprecated/removed modules.

* 0.7.0-0

* Remove pagination service from model

Will need to be provided on the component level.

* Upgrade zone & add karma shims

This doesn't make tests run yet, but needs to be done

* Feature/angular rc7 q free (#302)

* Remove unused styles

We are using the angular2-material equivalents of these styles

* Fix shadowed input

The  `range-format` input of md-pagination-range was getting overriden by the null value of the parent pagination directive.

* Update to Angular rc.6 and Typescript 2.0

 - Updated all package deps to their latest versions.
 - Updated just enough code to make the typescript compiler happy with new
   packages. Have not tested components other than the ones in our demo
   app.
 - Fixed pagination require from unstable source. Only imports from the
   root of @angular modules are to be trusted
 - Removed MdCard styles from components barell.
 - Added forRoot static method to both Ng2MaterialModule versions.

* Update to rc.7

Update dependencies to rc7, not observing any necessary code changes.

* Use local installation of typescript to build

* bump pre version

* Update dependencies to @angular 2.0.0 versions

* Update Angular Material to v alpha.8-2

Alpha 8-2 has updated dependencies to angular 2.0.0

* Update to @angular/material

The angular material 2 project has changed their packaging. They now distribute everything under the single package `@angular/material`.

Updated package files and removed references to any `@angular2-material/*` packages

* Set default-theme values to default

Setting default theme variables to default so that they can be overidden in app.

* Bump version

* chore: remove example app spec files

 - we don't add any testing to the example site, so they're just noise.

* chore: use typescript 2 with grunt ts

 - remove grunt-exec and specify a custom typescript compiler location in the grunt-ts configuration

* chore: remove card component and tests

 - as pointed out by @ollwenjones the styles are different than the official material2 implementation. let's avoid confusion. todo: look at updating the card examples (or remove them if it's too much work)

* chore: stash working changes to update test suite to use the latest angular apis

 - use TestBed for specs
 - update componentSanityCheck to use TestBed
 - update karma and systemjs configs to look like angular2 quickstart (https://github.com/angular/quickstart)
 - remove `main` function wrapper in test files and call describe when the module is imported (again to match angular/quickstart)
 - add dialog module
 - break pagination tests into individual files
 - add MdServicesModule for importing services

BREAKING CHANGE: remove md-card component

The card component conflicts with the official @angular/material/card implementation. Please use the official component. For more information see: https://github.com/angular/material2/tree/master/src/lib/card

* chore: remove form md-messages

 - the forms module has changed quite a bit and look competent enough to exist without these components.

BREAKING CHANGE: removed md-messages components and prefer to use standard FormsModule

* chore: fix up test suite

 - use async() to wrap any it() or beforeEach() calls that do promise based async stuff.
 - use `TestBed.get(ServiceTypeName)` instead of `inject()` when a service instance is needed in a test.

* chore: reduce sauce test matrix

BREAKING CHANGE: Remove support for automated testing of IE and unreliable builds of Chrome beta.

* chore: reduce sauce test matrix

BREAKING CHANGE: Remove support for automated testing of Chrome 39 and Android 4.4

* test: add spec to dialog component

* chore: fix bad package name

* feat(readme): update readme to direct new users to @angular/material

 - move some testing stuff out of the first line
 - update language to downplay any suggestion that users should create issues.  Instead suggest they provide a fix for the community.
 - remove gitter link (I never monitor it despite good intentions.)

* chore: drop android from sauce and add dev/beta for chrome/firefox

 - Android is failing to start sometimes. I have no patience for sauce flakiness.
 - Make all browsers run on Windows 10 in an attempt to reduce test start times
  • Loading branch information
ollwenjones authored and justindujardin committed Oct 12, 2016
1 parent 81116f4 commit 6b5fc52
Show file tree
Hide file tree
Showing 131 changed files with 2,041 additions and 5,109 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ root = true
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ install:
- ./node_modules/.bin/grunt build

script:
# TODO: When it can be run reliably from travis, add MICROSOFTEDGE_V13.10586
- karma start karma.sauce.conf.js --browsers IE_V11
- karma start karma.sauce.conf.js --browsers FIREFOX_V40,FIREFOX_V35
- karma start karma.sauce.conf.js --browsers CHROME_VBETA,CHROME_VDEV,CHROME_V39,CHROME_V26
- karma start karma.sauce.conf.js --browsers ANDROID_V5.1,ANDROID_V4.4
- karma start karma.sauce.conf.js --browsers FIREFOX_VBETA,FIREFOX_VDEV,FIREFOX_V49
- karma start karma.sauce.conf.js --browsers CHROME_VBETA,CHROME_VDEV,CHROME_V50
after_script:
- ./node_modules/.bin/grunt remapIstanbul
- ./node_modules/.bin/coveralls < .coverage/lcov.info
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
4 changes: 4 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ module.exports = function (grunt) {
source: {options: {message: 'Source Compiled'}}
},
ts: {
options: {
compiler: './node_modules/.bin/tsc'
},
source: {
tsconfig: true
}
Expand Down Expand Up @@ -246,6 +249,7 @@ module.exports = function (grunt) {
});

grunt.registerTask('build-npm', ['build', 'build-npm-package', 'rewrite-source-maps']);

grunt.registerTask('build-npm-package', function () {
var fs = require('fs');
var path = require('path');
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
ng2-material
---
[![Build Status](https://travis-ci.org/justindujardin/ng2-material.svg?branch=master)](https://travis-ci.org/justindujardin/ng2-material)
[![Coverage Status](https://coveralls.io/repos/justindujardin/ng2-material/badge.svg?branch=master&service=github)](https://coveralls.io/github/justindujardin/ng2-material?branch=master)
[![npm version](https://badge.fury.io/js/ng2-material.svg)](http://badge.fury.io/js/ng2-material)
[![Join the chat at https://gitter.im/justindujardin/ng2-material](https://badges.gitter.im/justindujardin/ng2-material.svg)](https://gitter.im/justindujardin/ng2-material?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/ng2material.svg)](https://saucelabs.com/u/ng2material)

ng2-material is a set of components, built on top of [@angular2-material/core](https://github.com/angular/material2), and a site full of examples of how to use them. The site contains examples for community
developed components as well as the official material2 components.
ng2-material is a set of components built on top of [@angular/material](https://github.com/angular/material2).

Check out the [examples site](https://justindujardin.github.io/ng2-material/) for demos and instructions on getting started.

## Getting Help
**IMPORTANT**: This project is provided as-is, and no commercial level of support is given to it. If you find an issue and would like to submit a fix, please open a Pull Request with your suggested changes.

**ALSO IMPORTANT** If you are new to Angular2 and in search of a set of material components, please visit [@angular/material](https://github.com/angular/material2) and come back here when you need a component not offered by the official package.

**IMPORTANT**: This project is provided as-is, and no commercial level of support is given to it. If you need perfect compatbility with IE or great getting started materials for your specific use-case, you may be better off waiting for an official release of material2.
## Testing

ng2-material components are checked against
[![Sauce Test Status](https://saucelabs.com/browser-matrix/ng2material.svg)](https://saucelabs.com/u/ng2material)

That being said, if something is wrong with your installation or with the existing examples or materials, please try to provide a Plunkr example reproducing your problem, and file an issue.
The tests exercise roughly [![Coverage Status](https://coveralls.io/repos/justindujardin/ng2-material/badge.svg?branch=master&service=github)](https://coveralls.io/github/justindujardin/ng2-material?branch=master) of the code on each browser

## Credits

Expand Down
12 changes: 1 addition & 11 deletions config.karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ var config = {
'@angular': {
defaultExtension: 'js'
},
'@angular2-material': {
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
}
},
map: {
'@angular': '/base/node_modules/@angular',
'@angular2-material': '/base/node_modules/@angular2-material',
'rxjs': '/base/node_modules/rxjs'
},
baseURL: './base/'
Expand All @@ -30,6 +26,7 @@ var packageNames = [
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/material',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
Expand All @@ -39,13 +36,6 @@ var packageNames = [
'@angular/upgrade'
];

var material2Packages = [
'core', 'checkbox'
];
material2Packages.forEach(function (pkgName) {
config.packages['@angular2-material/' + pkgName] = {main: pkgName + '.js', defaultExtension: 'js', format: 'cjs'}
});

// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function (pkgName) {
config.packages[pkgName] = {main: 'index.js', defaultExtension: 'js'};
Expand Down
89 changes: 89 additions & 0 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// #docregion
// /*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;

var builtPath = '/base/dist/';

__karma__.loaded = function () { };

function isJsFile(path) {
return path.slice(-3) == '.js';
}

function isSpecFile(path) {
return /_spec\.(.*\.)?js$/.test(path);
}

function isBuiltFile(path) {
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
}

var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isSpecFile)
.filter(isBuiltFile);

System.config({
baseURL: '/base',
// Extend usual application package list with test folder
packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } },

// Assume npm: is set in `paths` in systemjs.config
// 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('systemjs.config.js')
.then(importSystemJsExtras)
.then(initTestBed)
.then(initTesting);

/** Optional SystemJS configuration extras. Keep going w/o it */
function importSystemJsExtras(){
return System.import('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);
}
33 changes: 17 additions & 16 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,39 @@ module.exports = function (config) {
frameworks: ['jasmine'],

files: [
// Polyfills.
'node_modules/core-js/client/shim.min.js',

// System.js for module loading
// Polyfills.
'node_modules/core-js/client/shim.min.js',

// System.js for module loading
'node_modules/systemjs/dist/system.src.js',

// Zone.js dependencies
// Polyfills
'node_modules/core-js/client/shim.js',
'node_modules/reflect-metadata/Reflect.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.
// 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
// Paths loaded via module imports:
// Angular itself
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: true },
{ pattern: 'node_modules/@angular2-material/**/*.js', included: false, watched: false },
'karma.ie.shims.js',
"config.karma.js",
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false},

{pattern: 'systemjs.config.js', included: false, watched: false},
{pattern: 'systemjs.config.extras.js', included: false, watched: false},

{ pattern: 'dist/*.*', included: false, watched: true },
{ pattern: 'dist/components/**/*.js', included: false, watched: true },
{ pattern: 'dist/core/**/*.js', included: false, watched: true },
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it
{ pattern: 'dist/platform/**/*.js', included: false, watched: true },
"karma.main.js"
"karma-test-shim.js"
],
exclude: [
// Vendor packages might include spec files. We don't want to use those.
Expand Down
Loading

0 comments on commit 6b5fc52

Please sign in to comment.