Skip to content

Commit ede4dfc

Browse files
feat(all): incorporate pal
1 parent a0664f6 commit ede4dfc

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ System.config({
1515

1616
map: {
1717
"aurelia-metadata": "github:aurelia/[email protected]",
18+
"aurelia-pal": "github:aurelia/[email protected]",
19+
"aurelia-pal-browser": "github:aurelia/[email protected]",
1820
"aurelia-templating": "github:aurelia/[email protected]",
1921
"babel": "npm:[email protected]",
2022
"babel-runtime": "npm:[email protected]",
@@ -39,6 +41,9 @@ System.config({
3941
"github:aurelia/[email protected]": {
4042
"core-js": "npm:[email protected]"
4143
},
44+
"github:aurelia/[email protected]": {
45+
"aurelia-pal": "github:aurelia/[email protected]"
46+
},
4247
"github:aurelia/[email protected]": {
4348
"aurelia-binding": "github:aurelia/[email protected]",
4449
"aurelia-dependency-injection": "github:aurelia/[email protected]",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
},
2828
"dependencies": {
2929
"aurelia-metadata": "github:aurelia/metadata@^0.8.0",
30+
"aurelia-pal": "github:aurelia/pal@^0.1.10",
3031
"aurelia-templating": "github:aurelia/templating@^0.15.0"
3132
},
3233
"devDependencies": {
34+
"aurelia-pal-browser": "github:aurelia/pal-browser@^0.1.13",
3335
"babel": "npm:babel-core@^5.1.13",
3436
"babel-runtime": "npm:babel-runtime@^5.1.13",
3537
"core-js": "npm:core-js@^0.9.4"

src/animator.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {animationEvent} from 'aurelia-templating';
2+
import {DOM} from 'aurelia-pal';
23

34
interface CssAnimation {
45
className: string;
@@ -65,7 +66,7 @@ export class CssAnimator {
6566
* @returns animation-delay in seconds
6667
*/
6768
_getElementAnimationDelay(element: HTMLElement): number {
68-
let styl = window.getComputedStyle(element);
69+
let styl = DOM.getComputedStyle(element);
6970
let prop;
7071
let delay;
7172

@@ -119,8 +120,8 @@ export class CssAnimator {
119120
* @param element the element to be dispatched as event detail
120121
*/
121122
_triggerDOMEvent(eventType: string, element: HTMLElement): void {
122-
let evt = new window.CustomEvent(eventType, {bubbles: true, cancelable: true, detail: element});
123-
document.dispatchEvent(evt);
123+
let evt = DOM.createCustomEvent(eventType, {bubbles: true, cancelable: true, detail: element});
124+
DOM.dispatchEvent(evt);
124125
}
125126

126127
/* Public API Begin */

test/animate.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import {CssAnimator} from '../src/animator';
22
import {animationEvent} from 'aurelia-templating';
3+
import {initialize} from 'aurelia-pal-browser';
34

45
jasmine.getFixtures().fixturesPath = 'base/test/fixtures/';
56

67
describe('animator-css', () => {
78
var sut;
9+
beforeAll(() => initialize());
810
beforeEach(() => {
911
sut = new CssAnimator();
1012
});

test/animator.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import {configure} from '../src/index';
22
import {CssAnimator} from '../src/animator';
33
import {animationEvent} from 'aurelia-templating';
4+
import {initialize} from 'aurelia-pal-browser';
45

56
jasmine.getFixtures().fixturesPath = 'base/test/fixtures/';
67

78
describe('animator-css', () => {
89
var sut;
10+
beforeAll(() => initialize());
911
beforeEach( () => {
1012
sut = new CssAnimator();
1113
});

test/run-sequence.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import {CssAnimator} from '../src/animator';
22
import {animationEvent} from 'aurelia-templating';
3+
import {initialize} from 'aurelia-pal-browser';
34

45
jasmine.getFixtures().fixturesPath = 'base/test/fixtures/';
56

67
describe('animator-css', () => {
78
var sut;
9+
10+
beforeAll(() => initialize());
811
beforeEach(() => {
912
sut = new CssAnimator();
1013
});

0 commit comments

Comments
 (0)