redoc/tests/helpers.ts

27 lines
807 B
TypeScript
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';
2016-06-13 20:54:24 +03:00
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
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
2016-06-13 20:54:24 +03:00
var dispatchedEvent = getDOM().createMouseEvent('click');
2015-12-19 15:16:29 +03:00
// send click to element
2016-06-13 20:54:24 +03:00
getDOM().dispatchEvent(element, dispatchedEvent);
2015-12-19 15:16:29 +03:00
}