redoc/tests/helpers.js

28 lines
779 B
JavaScript
Raw Normal View History

2015-12-18 11:36:01 +03:00
'use strict';
2016-05-06 00:48:41 +03:00
import {By} from '@angular/platform-browser';
2015-12-18 11:36:01 +03:00
/** Gets a child DebugElement by tag name. */
export function getChildDebugElement(parent, tagName) {
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) {
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) {
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 );
}