angular-docs-cn/modules/e2e_test_lib/src/benchmark_util.js

17 lines
562 B
JavaScript
Raw Normal View History

import {DOM, document, location} from 'facade/dom';
import {NumberWrapper, BaseException, isBlank} from 'facade/lang';
export function getIntParameter(name:string) {
var el = DOM.querySelector(document, `input[name="${name}"]`);
if (isBlank(el)) {
throw new BaseException(`Could not find and input field with name ${name}`);
}
return NumberWrapper.parseInt(el.value, 10);
}
export function bindAction(selector:string, callback:Function) {
var el = DOM.querySelector(document, selector);
DOM.on(el, 'click', function(_) {
callback();
});
}