diff --git a/modules/examples/e2e_test/hello_world/hello_world_spec.dart b/modules/examples/e2e_test/hello_world/hello_world_spec.dart new file mode 100644 index 0000000000..8c250a59a1 --- /dev/null +++ b/modules/examples/e2e_test/hello_world/hello_world_spec.dart @@ -0,0 +1,5 @@ +library examples.e2e_test.hello_world.hello_world_spec; + +main() { + +} diff --git a/modules/examples/e2e_test/hello_world/hello_world_spec.es6 b/modules/examples/e2e_test/hello_world/hello_world_spec.ts similarity index 56% rename from modules/examples/e2e_test/hello_world/hello_world_spec.es6 rename to modules/examples/e2e_test/hello_world/hello_world_spec.ts index 93a8c98103..c331fccfe1 100644 --- a/modules/examples/e2e_test/hello_world/hello_world_spec.es6 +++ b/modules/examples/e2e_test/hello_world/hello_world_spec.ts @@ -1,7 +1,8 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); -describe('hello world', function () { +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; - afterEach(testUtil.verifyNoBrowserErrors); +describe('hello world', function() { + + afterEach(verifyNoBrowserErrors); describe('static reflection', function() { var URL = 'examples/src/hello_world/index.html'; @@ -9,14 +10,14 @@ describe('hello world', function () { it('should greet', function() { browser.get(URL); - expect(getComponentText('hello-app', '.greeting')).toBe('hello world!'); + expect(getComponentText('hello-app', '.greeting')).toEqual('hello world!'); }); it('should change greeting', function() { browser.get(URL); clickComponentButton('hello-app', '.changeButton'); - expect(getComponentText('hello-app', '.greeting')).toBe('howdy world!'); + expect(getComponentText('hello-app', '.greeting')).toEqual('howdy world!'); }); }); @@ -26,23 +27,25 @@ describe('hello world', function () { it('should greet', function() { browser.get(URL); - expect(getComponentText('hello-app', '.greeting')).toBe('hello world!'); + expect(getComponentText('hello-app', '.greeting')).toEqual('hello world!'); }); it('should change greeting', function() { browser.get(URL); clickComponentButton('hello-app', '.changeButton'); - expect(getComponentText('hello-app', '.greeting')).toBe('howdy world!'); + expect(getComponentText('hello-app', '.greeting')).toEqual('howdy world!'); }); }); }); function getComponentText(selector, innerSelector) { - return browser.executeScript('return document.querySelector("'+selector+'").querySelector("'+innerSelector+'").textContent'); + return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' + + innerSelector + '").textContent'); } function clickComponentButton(selector, innerSelector) { - return browser.executeScript('return document.querySelector("'+selector+'").querySelector("'+innerSelector+'").click()'); + return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' + + innerSelector + '").click()'); } diff --git a/modules/examples/e2e_test/key_events/key_events_spec.dart b/modules/examples/e2e_test/key_events/key_events_spec.dart new file mode 100644 index 0000000000..df4696b92a --- /dev/null +++ b/modules/examples/e2e_test/key_events/key_events_spec.dart @@ -0,0 +1,5 @@ +library examples.e2e_test.key_events.key_events_spec; + +main() { + +} diff --git a/modules/examples/e2e_test/key_events/key_events_spec.es6 b/modules/examples/e2e_test/key_events/key_events_spec.ts similarity index 72% rename from modules/examples/e2e_test/key_events/key_events_spec.es6 rename to modules/examples/e2e_test/key_events/key_events_spec.ts index 6810d6b19c..d6925ae3b4 100644 --- a/modules/examples/e2e_test/key_events/key_events_spec.es6 +++ b/modules/examples/e2e_test/key_events/key_events_spec.ts @@ -1,53 +1,52 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); -describe('key_events', function () { +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; + +describe('key_events', function() { var URL = 'examples/src/key_events/index.html'; - afterEach(testUtil.verifyNoBrowserErrors); - beforeEach(() => { - browser.get(URL); - }); + afterEach(verifyNoBrowserErrors); + beforeEach(() => { browser.get(URL); }); it('should display correct key names', function() { var firstArea = element.all(by.css('.sample-area')).get(0); - expect(firstArea.getText()).toBe('(none)'); + expect(firstArea.getText()).toEqual('(none)'); // testing different key categories: firstArea.sendKeys(protractor.Key.ENTER); - expect(firstArea.getText()).toBe('enter'); + expect(firstArea.getText()).toEqual('enter'); firstArea.sendKeys(protractor.Key.SHIFT, protractor.Key.ENTER); - expect(firstArea.getText()).toBe('shift.enter'); + expect(firstArea.getText()).toEqual('shift.enter'); firstArea.sendKeys(protractor.Key.CONTROL, protractor.Key.SHIFT, protractor.Key.ENTER); - expect(firstArea.getText()).toBe('control.shift.enter'); + expect(firstArea.getText()).toEqual('control.shift.enter'); firstArea.sendKeys(' '); - expect(firstArea.getText()).toBe('space'); + expect(firstArea.getText()).toEqual('space'); // It would not work with a letter which position depends on the keyboard layout (ie AZERTY vs // QWERTY), see https://code.google.com/p/chromedriver/issues/detail?id=553 firstArea.sendKeys('u'); - expect(firstArea.getText()).toBe('u'); + expect(firstArea.getText()).toEqual('u'); firstArea.sendKeys(protractor.Key.CONTROL, 'b'); - expect(firstArea.getText()).toBe('control.b'); + expect(firstArea.getText()).toEqual('control.b'); firstArea.sendKeys(protractor.Key.F1); - expect(firstArea.getText()).toBe('f1'); + expect(firstArea.getText()).toEqual('f1'); firstArea.sendKeys(protractor.Key.ALT, protractor.Key.F1); - expect(firstArea.getText()).toBe('alt.f1'); + expect(firstArea.getText()).toEqual('alt.f1'); firstArea.sendKeys(protractor.Key.CONTROL, protractor.Key.F1); - expect(firstArea.getText()).toBe('control.f1'); + expect(firstArea.getText()).toEqual('control.f1'); // There is an issue with protractor.Key.NUMPAD0 (and other NUMPADx): // chromedriver does not correctly set the location property on the event to // specify that the key is on the numeric keypad (event.location = 3) // so the following test fails: // firstArea.sendKeys(protractor.Key.NUMPAD0); - // expect(firstArea.getText()).toBe('0'); + // expect(firstArea.getText()).toEqual('0'); }); it('should correctly react to the specified key', function() { diff --git a/modules/examples/e2e_test/material/button_spec.dart b/modules/examples/e2e_test/material/button_spec.dart new file mode 100644 index 0000000000..41b3a3fa79 --- /dev/null +++ b/modules/examples/e2e_test/material/button_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.button_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/button_spec.es6 b/modules/examples/e2e_test/material/button_spec.ts similarity index 57% rename from modules/examples/e2e_test/material/button_spec.es6 rename to modules/examples/e2e_test/material/button_spec.ts index 2b034a7355..3a0470a398 100644 --- a/modules/examples/e2e_test/material/button_spec.es6 +++ b/modules/examples/e2e_test/material/button_spec.ts @@ -1,10 +1,10 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-button', function () { +describe('md-button', function() { var url = 'examples/src/material/button/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); // Buttons are broken right now, see https://github.com/angular/angular/issues/1602 }); diff --git a/modules/examples/e2e_test/material/checkbox_spec.dart b/modules/examples/e2e_test/material/checkbox_spec.dart new file mode 100644 index 0000000000..ea31922d36 --- /dev/null +++ b/modules/examples/e2e_test/material/checkbox_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.checkbox_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/checkbox_spec.es6 b/modules/examples/e2e_test/material/checkbox_spec.es6 deleted file mode 100644 index e27546911c..0000000000 --- a/modules/examples/e2e_test/material/checkbox_spec.es6 +++ /dev/null @@ -1,18 +0,0 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); - -describe('md-checkbox', function () { - var url = 'examples/src/material/checkbox/index.html'; - - beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); - - it('should toggle a checkbox', function() { - var checkbox = element.all(by.css('md-checkbox')).first(); - - checkbox.click(); - expect(checkbox.getAttribute('aria-checked')).toBe('true'); - - checkbox.click(); - expect(checkbox.getAttribute('aria-checked')).toBe('false'); - }); -}); diff --git a/modules/examples/e2e_test/material/checkbox_spec.ts b/modules/examples/e2e_test/material/checkbox_spec.ts new file mode 100644 index 0000000000..0f85d901e0 --- /dev/null +++ b/modules/examples/e2e_test/material/checkbox_spec.ts @@ -0,0 +1,18 @@ +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; + +describe('md-checkbox', function() { + var url = 'examples/src/material/checkbox/index.html'; + + beforeEach(() => { browser.get(url); }); + afterEach(verifyNoBrowserErrors); + + it('should toggle a checkbox', function() { + var checkbox = element.all(by.css('md-checkbox')).first(); + + checkbox.click(); + expect(checkbox.getAttribute('aria-checked')).toEqual('true'); + + checkbox.click(); + expect(checkbox.getAttribute('aria-checked')).toEqual('false'); + }); +}); diff --git a/modules/examples/e2e_test/material/dialog_spec.dart b/modules/examples/e2e_test/material/dialog_spec.dart new file mode 100644 index 0000000000..36954c6fd1 --- /dev/null +++ b/modules/examples/e2e_test/material/dialog_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.dialog_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/dialog_spec.es6 b/modules/examples/e2e_test/material/dialog_spec.ts similarity index 53% rename from modules/examples/e2e_test/material/dialog_spec.es6 rename to modules/examples/e2e_test/material/dialog_spec.ts index 95d3b69c65..8c0b65bd7f 100644 --- a/modules/examples/e2e_test/material/dialog_spec.es6 +++ b/modules/examples/e2e_test/material/dialog_spec.ts @@ -1,19 +1,19 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-dialog', function () { +describe('md-dialog', function() { var url = 'examples/src/material/dialog/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); it('should open a dialog', function() { var openButton = element(by.id('open')); openButton.click(); - expect(element(by.css('.md-dialog')).isPresent()).toBe(true); + expect(element(by.css('.md-dialog')).isPresent()).toEqual(true); var dialog = element(by.css('.md-dialog')); dialog.sendKeys(protractor.Key.ESCAPE); - expect(element(by.css('.md-dialog')).isPresent()).toBe(false); + expect(element(by.css('.md-dialog')).isPresent()).toEqual(false); }); }); diff --git a/modules/examples/e2e_test/material/grid_list_spec.dart b/modules/examples/e2e_test/material/grid_list_spec.dart new file mode 100644 index 0000000000..578b017c3d --- /dev/null +++ b/modules/examples/e2e_test/material/grid_list_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.grid_list_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/grid_list_spec.es6 b/modules/examples/e2e_test/material/grid_list_spec.ts similarity index 78% rename from modules/examples/e2e_test/material/grid_list_spec.es6 rename to modules/examples/e2e_test/material/grid_list_spec.ts index d3e2e4e3b3..76d13c0373 100644 --- a/modules/examples/e2e_test/material/grid_list_spec.es6 +++ b/modules/examples/e2e_test/material/grid_list_spec.ts @@ -1,10 +1,10 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-grid-list', function () { +describe('md-grid-list', function() { var url = 'examples/src/material/grid_list/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); it('should set tiles into different positions', () => { var tiles = element.all(by.css('md-grid-list#complex md-grid-tile')); diff --git a/modules/examples/e2e_test/material/input_spec.dart b/modules/examples/e2e_test/material/input_spec.dart new file mode 100644 index 0000000000..7133081fdb --- /dev/null +++ b/modules/examples/e2e_test/material/input_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.input_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/input_spec.es6 b/modules/examples/e2e_test/material/input_spec.ts similarity index 57% rename from modules/examples/e2e_test/material/input_spec.es6 rename to modules/examples/e2e_test/material/input_spec.ts index e18a617b50..2c67c0ab2b 100644 --- a/modules/examples/e2e_test/material/input_spec.es6 +++ b/modules/examples/e2e_test/material/input_spec.ts @@ -1,17 +1,16 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-input', function () { +describe('md-input', function() { var url = 'examples/src/material/input/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); it('should enter a value to the input', () => { var input = element.all(by.css('md-input-container input')).first(); input.sendKeys('Hello'); - expect(input.getAttribute('value')).toBe('Hello'); + expect(input.getAttribute('value')).toEqual('Hello'); }); }); - diff --git a/modules/examples/e2e_test/material/progress_linear_spec.dart b/modules/examples/e2e_test/material/progress_linear_spec.dart new file mode 100644 index 0000000000..4d5d3352d6 --- /dev/null +++ b/modules/examples/e2e_test/material/progress_linear_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.progress_linear_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/progress_linear_spec.es6 b/modules/examples/e2e_test/material/progress_linear_spec.ts similarity index 82% rename from modules/examples/e2e_test/material/progress_linear_spec.es6 rename to modules/examples/e2e_test/material/progress_linear_spec.ts index 3e332cc0a5..ad78e048db 100644 --- a/modules/examples/e2e_test/material/progress_linear_spec.es6 +++ b/modules/examples/e2e_test/material/progress_linear_spec.ts @@ -1,10 +1,10 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-progress-linear', function () { +describe('md-progress-linear', function() { var url = 'examples/src/material/progress-linear/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); it('should increment and decrement progress', function() { var progressBar = element.all(by.css('md-progress-linear')).first(); diff --git a/modules/examples/e2e_test/material/radio_spec.dart b/modules/examples/e2e_test/material/radio_spec.dart new file mode 100644 index 0000000000..276bd9c6ab --- /dev/null +++ b/modules/examples/e2e_test/material/radio_spec.dart @@ -0,0 +1,3 @@ +library examples.e2e_test.material.radio_spec; + +main() {} diff --git a/modules/examples/e2e_test/material/radio_spec.es6 b/modules/examples/e2e_test/material/radio_spec.ts similarity index 52% rename from modules/examples/e2e_test/material/radio_spec.es6 rename to modules/examples/e2e_test/material/radio_spec.ts index 6058a21c9b..03b2f286ee 100644 --- a/modules/examples/e2e_test/material/radio_spec.es6 +++ b/modules/examples/e2e_test/material/radio_spec.ts @@ -1,10 +1,10 @@ -var testUtil = require('angular2/src/test_lib/e2e_util'); +import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util'; -describe('md-radio-button', function () { +describe('md-radio-button', function() { var url = 'examples/src/material/radio/index.html'; beforeEach(() => { browser.get(url); }); - afterEach(testUtil.verifyNoBrowserErrors); + afterEach(verifyNoBrowserErrors); it('should check one radio button and then check another', () => { var standaloneRadios = element.all(by.css('[name="element"]')); @@ -12,10 +12,10 @@ describe('md-radio-button', function () { var lastRadio = standaloneRadios.last(); firstRadio.click(); - expect(firstRadio.getAttribute('aria-checked')).toBe('true'); + expect(firstRadio.getAttribute('aria-checked')).toEqual('true'); lastRadio.click(); - expect(firstRadio.getAttribute('aria-checked')).toBe('false'); - expect(lastRadio.getAttribute('aria-checked')).toBe('true'); + expect(firstRadio.getAttribute('aria-checked')).toEqual('false'); + expect(lastRadio.getAttribute('aria-checked')).toEqual('true'); }); }); diff --git a/modules/examples/e2e_test/sourcemap/sourcemap_spec.dart b/modules/examples/e2e_test/sourcemap/sourcemap_spec.dart new file mode 100644 index 0000000000..214405f8ad --- /dev/null +++ b/modules/examples/e2e_test/sourcemap/sourcemap_spec.dart @@ -0,0 +1,5 @@ +library examples.e2e_test.sourcemap.sourcemap_spec; + +main() { + +} diff --git a/modules/examples/e2e_test/sourcemap/sourcemap_spec.es6 b/modules/examples/e2e_test/sourcemap/sourcemap_spec.ts similarity index 69% rename from modules/examples/e2e_test/sourcemap/sourcemap_spec.es6 rename to modules/examples/e2e_test/sourcemap/sourcemap_spec.ts index 291973cd5c..c29b2b2c50 100644 --- a/modules/examples/e2e_test/sourcemap/sourcemap_spec.es6 +++ b/modules/examples/e2e_test/sourcemap/sourcemap_spec.ts @@ -1,7 +1,9 @@ +import * as testUtil from 'angular2/src/test_lib/e2e_util'; + var fs = require('fs'); var sourceMap = require('source-map'); -describe('sourcemaps', function () { +describe('sourcemaps', function() { var URL = 'examples/src/sourcemap/index.html'; it('should map sources', function() { @@ -27,23 +29,19 @@ describe('sourcemaps', function () { expect(errorColumn).not.toBeNull(); - var sourceMapData = fs.readFileSync( - 'dist/js/prod/es5/examples/src/sourcemap/index.js.map'); + var sourceMapData = fs.readFileSync('dist/js/prod/es5/examples/src/sourcemap/index.js.map'); var decoder = new sourceMap.SourceMapConsumer(JSON.parse(sourceMapData)); - var originalPosition = decoder.originalPositionFor({ - line: errorLine, - column: errorColumn - }); + var originalPosition = decoder.originalPositionFor({line: errorLine, column: errorColumn}); - var finalMapData = fs.readFileSync( - 'dist/js/prod/es6/examples/src/sourcemap/index.es6.map'); + var finalMapData = fs.readFileSync('dist/js/prod/es6/examples/src/sourcemap/index.es6.map'); var finalDecoder = new sourceMap.SourceMapConsumer(JSON.parse(finalMapData)); var finalPosition = finalDecoder.originalPositionFor(originalPosition); - var sourceCodeLines = fs.readFileSync('modules/examples/src/sourcemap/index.ts', - {encoding: 'UTF-8'}).split('\n'); + var sourceCodeLines = + fs.readFileSync('modules/examples/src/sourcemap/index.ts', {encoding: 'UTF-8'}) + .split('\n'); expect(sourceCodeLines[finalPosition.line - 1]) .toMatch(/throw new BaseException\(\'Sourcemap test\'\)/); });