parent
280aae6fc5
commit
55047eaa10
|
@ -23,9 +23,9 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button id="create">create</button>
|
<button id="create">create</button>
|
||||||
<button id="detectChanges">detect changes</button>
|
<button id="update">update</button>
|
||||||
<button id="destroy">destroy</button>
|
<button id="destroy">destroy</button>
|
||||||
<button id="profile">profile detect changes</button>
|
<button id="profile_update">profile update</button>
|
||||||
<button id="modify">modify externally</button>
|
<button id="modify">modify externally</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ export function init(moduleRef: NgModuleRef<StylingModule>) {
|
||||||
appRef.tick();
|
appRef.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectChanges() {
|
function update() {
|
||||||
component.exp = component.exp === 'bar' ? 'baz' : 'bar';
|
component.exp = component.exp === 'bar' ? 'baz' : 'bar';
|
||||||
appRef.tick();
|
appRef.tick();
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ export function init(moduleRef: NgModuleRef<StylingModule>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindAction('#create', () => create(select.selectedIndex));
|
bindAction('#create', () => create(select.selectedIndex));
|
||||||
bindAction('#detectChanges', detectChanges);
|
bindAction('#update', update);
|
||||||
bindAction('#destroy', destroy);
|
bindAction('#destroy', destroy);
|
||||||
bindAction('#profile', profile(() => {
|
bindAction('#profile_update', profile(() => {
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
detectChanges();
|
update();
|
||||||
}
|
}
|
||||||
}, () => {}, 'detect changes'));
|
}, () => {}, 'update and detect changes'));
|
||||||
bindAction('#modify', modifyExternally);
|
bindAction('#modify', modifyExternally);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,13 @@ const SCENARIOS = [
|
||||||
describe('styling benchmark spec', () => {
|
describe('styling benchmark spec', () => {
|
||||||
afterEach(verifyNoBrowserErrors);
|
afterEach(verifyNoBrowserErrors);
|
||||||
|
|
||||||
it('should render and interact to change detection', () => {
|
it('should render and interact to update and detect changes', () => {
|
||||||
openBrowser({url: '/', ignoreBrowserSynchronization: true});
|
openBrowser({url: '/', ignoreBrowserSynchronization: true});
|
||||||
create();
|
create();
|
||||||
const items = element.all(by.css('styling-bindings button'));
|
const items = element.all(by.css('styling-bindings button'));
|
||||||
expect(items.count()).toBe(2000);
|
expect(items.count()).toBe(2000);
|
||||||
expect(items.first().getAttribute('title')).toBe('bar');
|
expect(items.first().getAttribute('title')).toBe('bar');
|
||||||
detectChanges();
|
update();
|
||||||
expect(items.first().getAttribute('title')).toBe('baz');
|
expect(items.first().getAttribute('title')).toBe('baz');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ describe('styling benchmark spec', () => {
|
||||||
SCENARIOS.forEach(({optionIndex, id}) => {
|
SCENARIOS.forEach(({optionIndex, id}) => {
|
||||||
describe(id, () => {
|
describe(id, () => {
|
||||||
it('should run detect_changes benchmark', done => {
|
it('should run detect_changes benchmark', done => {
|
||||||
runStylingBenchmark(`styling.${id}.detect_changes`, {
|
runStylingBenchmark(`styling.${id}.update`, {
|
||||||
work: () => detectChanges(),
|
work: () => update(),
|
||||||
prepare: () => {
|
prepare: () => {
|
||||||
// Switch to the current scenario by clicking the corresponding option.
|
// Switch to the current scenario by clicking the corresponding option.
|
||||||
element.all(by.tagName('option')).get(optionIndex).click();
|
element.all(by.tagName('option')).get(optionIndex).click();
|
||||||
|
@ -54,8 +54,8 @@ function create() {
|
||||||
$('#create').click();
|
$('#create').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectChanges() {
|
function update() {
|
||||||
$('#detectChanges').click();
|
$('#update').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue