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