@ -136,7 +136,7 @@ export class RenderViewWithFragmentsStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var viewRef = this.deserializeRenderViewRef(obj['viewRef']);
|
var viewRef = this.deserializeRenderViewRef(obj['viewRef']);
|
||||||
var fragments = obj['fragmentRefs'].map(val => this.deserializeRenderFragmentRef(val));
|
var fragments = (<any[]>obj['fragmentRefs']).map(val => this.deserializeRenderFragmentRef(val));
|
||||||
|
|
||||||
return new RenderViewWithFragments(viewRef, fragments);
|
return new RenderViewWithFragments(viewRef, fragments);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/test_lib';
|
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/test_lib';
|
||||||
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||||
import {MapWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {Parser} from 'angular2/src/core/change_detection/parser/parser';
|
import {Parser} from 'angular2/src/core/change_detection/parser/parser';
|
||||||
import {Unparser} from './unparser';
|
import {Unparser} from './unparser';
|
||||||
import {Lexer} from 'angular2/src/core/change_detection/parser/lexer';
|
import {Lexer} from 'angular2/src/core/change_detection/parser/lexer';
|
||||||
@ -270,9 +269,11 @@ export function main() {
|
|||||||
|
|
||||||
describe('parseTemplateBindings', () => {
|
describe('parseTemplateBindings', () => {
|
||||||
|
|
||||||
function keys(templateBindings) { return templateBindings.map(binding => binding.key); }
|
function keys(templateBindings: any[]) {
|
||||||
|
return templateBindings.map(binding => binding.key);
|
||||||
|
}
|
||||||
|
|
||||||
function keyValues(templateBindings) {
|
function keyValues(templateBindings: any[]) {
|
||||||
return templateBindings.map(binding => {
|
return templateBindings.map(binding => {
|
||||||
if (binding.keyIsVar) {
|
if (binding.keyIsVar) {
|
||||||
return '#' + binding.key + (isBlank(binding.name) ? '=null' : '=' + binding.name);
|
return '#' + binding.key + (isBlank(binding.name) ? '=null' : '=' + binding.name);
|
||||||
@ -282,7 +283,7 @@ export function main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function exprSources(templateBindings) {
|
function exprSources(templateBindings: any[]) {
|
||||||
return templateBindings.map(
|
return templateBindings.map(
|
||||||
binding => isPresent(binding.expression) ? binding.expression.source : null);
|
binding => isPresent(binding.expression) ? binding.expression.source : null);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ export class ConsoleReporter extends Reporter {
|
|||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
_printStringRow(parts, fill = ' ') {
|
_printStringRow(parts: any[], fill = ' ') {
|
||||||
this._print(
|
this._print(
|
||||||
parts.map(part => ConsoleReporter._lpad(part, this._columnWidth, fill)).join(' | '));
|
parts.map(part => ConsoleReporter._lpad(part, this._columnWidth, fill)).join(' | '));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
import {MeasureValues} from '../measure_values';
|
import {MeasureValues} from '../measure_values';
|
||||||
|
@ -17,7 +17,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
|||||||
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
|
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function createMetric(ids) {
|
function createMetric(ids: any[]) {
|
||||||
var m = Injector.resolveAndCreate([
|
var m = Injector.resolveAndCreate([
|
||||||
ids.map(id => bind(id).toValue(new MockMetric(id))),
|
ids.map(id => bind(id).toValue(new MockMetric(id))),
|
||||||
MultiMetric.createBindings(ids)
|
MultiMetric.createBindings(ids)
|
||||||
|
@ -11,14 +11,13 @@ import {
|
|||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||||
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
import {Reporter, MultiReporter, bind, Injector, MeasureValues} from 'benchpress/common';
|
import {Reporter, MultiReporter, bind, Injector, MeasureValues} from 'benchpress/common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function createReporters(ids) {
|
function createReporters(ids: any[]) {
|
||||||
var r = Injector.resolveAndCreate([
|
var r = Injector.resolveAndCreate([
|
||||||
ids.map(id => bind(id).toValue(new MockReporter(id))),
|
ids.map(id => bind(id).toValue(new MockReporter(id))),
|
||||||
MultiReporter.createBindings(ids)
|
MultiReporter.createBindings(ids)
|
||||||
|
@ -11,14 +11,13 @@ import {
|
|||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
||||||
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
import {WebDriverExtension, bind, Injector, Options} from 'benchpress/common';
|
import {WebDriverExtension, bind, Injector, Options} from 'benchpress/common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function createExtension(ids, caps) {
|
function createExtension(ids: any[], caps) {
|
||||||
return PromiseWrapper.wrap(() => {
|
return PromiseWrapper.wrap(() => {
|
||||||
return Injector.resolveAndCreate([
|
return Injector.resolveAndCreate([
|
||||||
ids.map(id => bind(id).toValue(new MockExtension(id))),
|
ids.map(id => bind(id).toValue(new MockExtension(id))),
|
||||||
|
@ -13,11 +13,6 @@ import {ObservableWrapper, PromiseWrapper, Promise} from 'angular2/src/core/faca
|
|||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
interface RecordData {
|
|
||||||
id: string, subject: string, content: string, email: string, firstName: string, lastName: string,
|
|
||||||
date: string, draft?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
class InboxRecord {
|
class InboxRecord {
|
||||||
id: string = '';
|
id: string = '';
|
||||||
subject: string = '';
|
subject: string = '';
|
||||||
@ -28,13 +23,29 @@ class InboxRecord {
|
|||||||
date: string = '';
|
date: string = '';
|
||||||
draft: boolean = false;
|
draft: boolean = false;
|
||||||
|
|
||||||
constructor(data: RecordData = null) {
|
constructor(data: {
|
||||||
|
id: string,
|
||||||
|
subject: string,
|
||||||
|
content: string,
|
||||||
|
email: string,
|
||||||
|
firstName: string,
|
||||||
|
lastName: string,
|
||||||
|
date: string, draft?: boolean
|
||||||
|
} = null) {
|
||||||
if (isPresent(data)) {
|
if (isPresent(data)) {
|
||||||
this.setData(data);
|
this.setData(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setData(record: RecordData) {
|
setData(record: {
|
||||||
|
id: string,
|
||||||
|
subject: string,
|
||||||
|
content: string,
|
||||||
|
email: string,
|
||||||
|
firstName: string,
|
||||||
|
lastName: string,
|
||||||
|
date: string, draft?: boolean
|
||||||
|
}) {
|
||||||
this.id = record['id'];
|
this.id = record['id'];
|
||||||
this.subject = record['subject'];
|
this.subject = record['subject'];
|
||||||
this.content = record['content'];
|
this.content = record['content'];
|
||||||
@ -48,26 +59,26 @@ class InboxRecord {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class DbService {
|
class DbService {
|
||||||
getData(): Promise<RecordData[]> {
|
getData(): Promise<any[]> {
|
||||||
var p = PromiseWrapper.completer();
|
var p = PromiseWrapper.completer();
|
||||||
p.resolve(db.data);
|
p.resolve(db.data);
|
||||||
return p.promise;
|
return p.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
drafts(): Promise<RecordData[]> {
|
drafts(): Promise<any[]> {
|
||||||
return PromiseWrapper.then(this.getData(), (data) => {
|
return PromiseWrapper.then(this.getData(), (data) => {
|
||||||
return ListWrapper.filter(data,
|
return ListWrapper.filter(data,
|
||||||
(record => isPresent(record['draft']) && record['draft'] == true));
|
(record => isPresent(record['draft']) && record['draft'] == true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
emails(): Promise<RecordData[]> {
|
emails(): Promise<any[]> {
|
||||||
return PromiseWrapper.then(this.getData(), (data) => {
|
return PromiseWrapper.then(this.getData(), (data) => {
|
||||||
return ListWrapper.filter(data, (record => !isPresent(record['draft'])));
|
return ListWrapper.filter(data, (record => !isPresent(record['draft'])));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
email(id): Promise<RecordData> {
|
email(id): Promise<any> {
|
||||||
return PromiseWrapper.then(this.getData(), (data) => {
|
return PromiseWrapper.then(this.getData(), (data) => {
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
var entry = data[i];
|
var entry = data[i];
|
||||||
|
Reference in New Issue
Block a user