///
///
declare function sandbox(attributes?: any): string;
declare function readFixtures(...uls: string[]): string;
declare function preloadFixtures(...uls: string[]): void;
declare function loadFixtures(...uls: string[]): void;
declare function appendLoadFixtures(...uls: string[]): void;
declare function setFixtures(html: string): string;
declare function appendSetFixtures(html: string): void;
declare function preloadStyleFixtures(...uls: string[]): void;
declare function loadStyleFixtures(...uls: string[]): void;
declare function appendLoadStyleFixtures(...uls: string[]): void;
declare function setStyleFixtures(html: string): void;
declare function appendSetStyleFixtures(html: string): void;
declare function loadJSONFixtures(...uls: string[]): jasmine.JSONFixtures;
declare function getJSONFixture(url: string): any;
declare function spyOnEvent(selector: string, eventName: string): jasmine.JQueryEventSpy;
declare namespace jasmine {
function spiedEventsKey(selector: JQuery, eventName: string): string;
function getFixtures(): Fixtures;
function getStyleFixtures(): StyleFixtures;
function getJSONFixtures(): JSONFixtures;
interface Fixtures {
fixturesPath: string;
containerId: string;
set(html: string): string;
appendSet(html: string): void;
preload(...uls: string[]): void;
load(...uls: string[]): void;
appendLoad(...uls: string[]): void;
read(...uls: string[]): string;
clearCache(): void;
cleanUp(): void;
sandbox(attributes?: any): string;
createContainer_(html: string): string;
addToContainer_(html: string): void;
getFixtureHtml_(url: string): string;
loadFixtureIntoCache_(relativeUrl: string): void;
makeFixtureUrl_(relativeUrl: string): string;
proxyCallTo_(methodName: string, passedArguments: any): any;
}
interface StyleFixtures {
fixturesPath: string;
set(html: string): string;
appendSet(html: string): void;
preload(...uls: string[]): void;
load(...uls: string[]): void;
appendLoad(...uls: string[]): void;
read_(...uls: string[]): string;
clearCache(): void;
cleanUp(): void;
createStyle_(html: string): void;
getFixtureHtml_(url: string): string;
loadFixtureIntoCache_(relativeUrl: string): void;
makeFixtureUrl_(relativeUrl: string): string;
proxyCallTo_(methodName: string, passedArguments: any): any;
}
interface JSONFixtures {
fixturesPath: string;
load(...uls: string[]): void;
read(...uls: string[]): string;
clearCache(): void;
getFixtureData_(url: string): any;
loadFixtureIntoCache_(relativeUrl: string): void;
proxyCallTo_(methodName: string, passedArguments: any): any;
}
interface Matchers {
/**
* Check if DOM element has class.
*
* @param className Name of the class to check.
*
* @example
* // returns true
* expect($('')).toHaveClass("some-class")
*/
toHaveClass(className: string): void;
/**
* Check if DOM element has the given CSS properties.
*
* @param css Object containing the properties (and values) to check.
*
* @example
* // returns true
* expect($('')).toHaveCss({display: "none", margin: "10px"})
*
* @example
* // returns true
* expect($('')).toHaveCss({margin: "10px"})
*/
toHaveCss(css: any): void;
/**
* Checks if DOM element is visible.
* Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.
*/
toBeVisible(): void;
/**
* Check if DOM element is hidden.
* Elements can be hidden for several reasons:
* - They have a CSS display value of none ;
* - They are form elements with type equal to hidden.
* - Their width and height are explicitly set to 0.
* - An ancestor element is hidden, so the element is not shown on the page.
*/
toBeHidden(): void;
/**
* Only for tags that have checked attribute
*
* @example
* // returns true
* expect($('')).toBeSelected()
*/
toBeSelected(): void;
/**
* Only for tags that have checked attribute
* @example
* // returns true
* expect($('')).toBeChecked()
*/
toBeChecked(): void;
/**
* Checks for child DOM elements or text
*/
toBeEmpty(): void;
/**
* Checks if element exists in or out the DOM.
*/
toExist(): void;
/**
* Checks if array has the given length.
*
* @param length Expected length
*/
toHaveLength(length: number): void;
/**
* Check if DOM element contains an attribute and, optionally, if the value of the attribute is equal to the expected one.
*
* @param attributeName Name of the attribute to check
* @param expectedAttributeValue Expected attribute value
*/
toHaveAttr(attributeName: string, expectedAttributeValue?: any): void;
/**
* Check if DOM element contains a property and, optionally, if the value of the property is equal to the expected one.
*
* @param propertyName Property name to check
* @param expectedPropertyValue Expected property value
*/
toHaveProp(propertyName: string, expectedPropertyValue?: any): void;
/**
* Check if DOM element has the given Id
*
* @param Id Expected identifier
*/
toHaveId(id: string): void;
/**
* Check if DOM element has the specified HTML.
*
* @example
* // returns true
* expect($('
')).toHaveHtml('')
*/
toHaveHtml(html: string): void;
/**
* Check if DOM element contains the specified HTML.
*
* @example
* // returns true
* expect($('
header
')).toContainHtml('
')
*/
toContainHtml(html: string): void;
/**
* Check if DOM element has the given Text.
* @param text Accepts a string or regular expression
*
* @example
* // returns true
* expect($('
some text
')).toHaveText('some text')
*/
toHaveText(text: string): void;
/**
* Check if DOM element contains the specified text.
*
* @example
* // returns true
* expect($('
header
')).toContainText('header')
*/
toContainText(text: string): void;
/**
* Check if DOM element has the given value.
* This can only be applied for element on with jQuery val() can be called.
*
* @example
* // returns true
* expect($('')).toHaveValue('some text')
*/
toHaveValue(value: string): void;
/**
* Check if DOM element has the given data.
* This can only be applied for element on with jQuery data(key) can be called.
*/
toHaveData(key: string, expectedValue: string): void;
toBe(selector: T): void;
/**
* Check if DOM element is matched by the given selector.
*
* @example
* // returns true
* expect($('
')).toContain('some-class')
*/
toContain(selector: any): void;
/**
* Check if DOM element exists inside the given parent element.
*
* @example
* // returns true
* expect($('
')).toContainElement('span.some-class')
*/
toContainElement(selector: string): void;
/**
* Check to see if the set of matched elements matches the given selector
*
* @example
* expect($('').addClass('js-something')).toBeMatchedBy('.js-something')
*
* @returns {Boolean} true if DOM contains the element
*/
toBeMatchedBy(selector: string): void;
/**
* Only for tags that have disabled attribute
* @example
* // returns true
* expect('').toBeDisabled()
*/
toBeDisabled(): void;
/**
* Check if DOM element is focused
* @example
* // returns true
* expect($('').focus()).toBeFocused()
*/
toBeFocused(): void;
/**
* Checks if DOM element handles event.
*
* @example
* // returns true
* expect($form).toHandle("submit")
*/
toHandle(eventName: string): void;
/**
* Assigns a callback to an event of the DOM element.
*
* @param eventName Name of the event to assign the callback to.
* @param eventHandler Callback function to be assigned.
*
* @example
* expect($form).toHandleWith("submit", yourSubmitCallback)
*/
toHandleWith(eventName: string, eventHandler: JQueryCallback): void;
/**
* Checks if event was triggered.
*/
toHaveBeenTriggered(): void;
/**
* Checks if the event has been triggered on selector.
* @param selector Selector that should have triggered the event.
*/
toHaveBeenTriggeredOn(selector: string): void;
/**
* Checks if the event has been triggered on selector.
* @param selector Selector that should have triggered the event.
* @param args Extra arguments to be passed to jQuery events functions.
*/
toHaveBeenTriggeredOnAndWith(selector: string, ...args: any[]): void;
/**
* Checks if event propagation has been prevented.
*/
toHaveBeenPrevented(): void;
/**
* Checks if event propagation has been prevented on element with selector.
*
* @param selector Selector that should have prevented the event.
*/
toHaveBeenPreventedOn(selector: string): void;
/**
* Checks if event propagation has been stopped.
*
* @example
* // returns true
* var spyEvent = spyOnEvent('#some_element', 'click')
* $('#some_element').click(function (event){event.stopPropagation();})
* $('#some_element').click()
* expect(spyEvent).toHaveBeenStopped()
*/
toHaveBeenStopped(): void;
/**
* Checks if event propagation has been stopped by an element with the given selector.
* @param selector Selector of the element that should have stopped the event propagation.
*
* @example
* // returns true
* $('#some_element').click(function (event){event.stopPropagation();})
* $('#some_element').click()
* expect('click').toHaveBeenStoppedOn('#some_element')
*/
toHaveBeenStoppedOn(selector: string): void;
/**
* Checks to see if the matched element is attached to the DOM.
* @example
* expect($('#id-name')[0]).toBeInDOM()
*/
toBeInDOM(): void;
}
interface JQueryEventSpy {
selector: string;
eventName: string;
handler(eventObject: JQueryEventObject): any;
reset(): any;
}
interface JasmineJQuery {
browserTagCaseIndependentHtml(html: string): string;
elementToString(element: JQuery): string;
matchersClass: any;
events: JasmineJQueryEvents;
}
interface JasmineJQueryEvents {
spyOn(selector: string, eventName: string): JQueryEventSpy;
args(selector: string, eventName: string): any;
wasTriggered(selector: string, eventName: string): boolean;
wasTriggeredWith(selector: string, eventName: string, expectedArgs: any, env: jasmine.Env): boolean;
wasPrevented(selector: string, eventName: string): boolean;
wasStopped(selector: string, eventName: string): boolean;
cleanUp(): void;
}
var JQuery: JasmineJQuery;
}