2015-12-18 11:36:01 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-02-11 14:38:44 +03:00
|
|
|
import {By} from 'angular2/platform/browser';
|
2015-12-18 11:36:01 +03:00
|
|
|
|
|
|
|
/** Gets a child DebugElement by tag name. */
|
|
|
|
export function getChildDebugElement(parent, tagName) {
|
2016-02-11 14:38:44 +03:00
|
|
|
return parent.query(By.css(tagName));
|
2015-12-18 11:36:01 +03:00
|
|
|
}
|
2015-12-19 15:16:29 +03:00
|
|
|
|
2016-01-21 01:09:42 +03:00
|
|
|
/** Gets a child DebugElement by Component Type. */
|
|
|
|
export function getChildDebugElementByType(parent, type) {
|
2016-02-11 14:38:44 +03:00
|
|
|
return parent.query(By.directive(type));
|
2016-01-21 01:09:42 +03:00
|
|
|
}
|
|
|
|
|
2015-12-19 16:31:09 +03:00
|
|
|
/** Gets a child DebugElements by tag name. */
|
|
|
|
export function getChildDebugElementAll(parent, tagName) {
|
2016-02-11 14:38:44 +03:00
|
|
|
return parent.queryAll(By.css(tagName));
|
2015-12-19 16:31:09 +03:00
|
|
|
}
|
|
|
|
|
2015-12-19 15:16:29 +03:00
|
|
|
export function mouseclick( element ) {
|
|
|
|
// create a mouse click event
|
|
|
|
var event = document.createEvent( 'MouseEvents' );
|
|
|
|
event.initMouseEvent( 'click', true, true, window, 1, 0, 0 );
|
|
|
|
|
|
|
|
// send click to element
|
|
|
|
element.dispatchEvent( event );
|
|
|
|
}
|