UNPKG

119 kBTypeScriptView Raw
1// Type definitions for chai-jquery 1.1.1
2// Project: https://github.com/chaijs/chai-jquery
3// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.0
6
7/// <reference types="chai" />
8/// <reference types="jquery" />
9
10declare namespace Chai {
11
12 interface Assertion {
13 attr(name: string, value?: string): Assertion;
14 prop(name: string, value?: any): Assertion;
15 css(name: string, value?: string): Assertion;
16 data(name: string, value?: string): Assertion;
17 class(className: string): Assertion;
18 id(id: string): Assertion;
19 html(html: string): Assertion;
20 text(text: string): Assertion;
21 value(text: string): Assertion;
22 descendants(selector: string): Assertion;
23 visible(): Assertion;
24 hidden(): Assertion;
25 selected(): Assertion;
26 checked(): Assertion;
27 disabled(): Assertion;
28 enabled(): Assertion;
29 (selector: string): Assertion;
30 }
31
32 interface Match {
33 (selector: string): Assertion;
34 }
35}
36
37/**
38 * Static members of chai-jquery (those on $ and jQuery themselves)
39 */
40interface ChaiJQueryStatic {
41
42 /**
43 * Perform an asynchronous HTTP (Ajax) request.
44 *
45 * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
46 */
47 ajax(settings: JQueryAjaxSettings): JQueryXHR;
48 /**
49 * Perform an asynchronous HTTP (Ajax) request.
50 *
51 * @param url A string containing the URL to which the request is sent.
52 * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
53 */
54 ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
55
56 /**
57 * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
58 *
59 * @param dataTypes An optional string containing one or more space-separated dataTypes
60 * @param handler A handler to set default values for future Ajax requests.
61 */
62 ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
63 /**
64 * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
65 *
66 * @param handler A handler to set default values for future Ajax requests.
67 */
68 ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
69
70 ajaxSettings: JQueryAjaxSettings;
71
72 /**
73 * Set default values for future Ajax requests. Its use is not recommended.
74 *
75 * @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
76 */
77 ajaxSetup(options: JQueryAjaxSettings): void;
78
79 /**
80 * Load data from the server using a HTTP GET request.
81 *
82 * @param url A string containing the URL to which the request is sent.
83 * @param success A callback function that is executed if the request succeeds.
84 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
85 */
86 get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
87 /**
88 * Load data from the server using a HTTP GET request.
89 *
90 * @param url A string containing the URL to which the request is sent.
91 * @param data A plain object or string that is sent to the server with the request.
92 * @param success A callback function that is executed if the request succeeds.
93 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
94 */
95 get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
96 /**
97 * Load JSON-encoded data from the server using a GET HTTP request.
98 *
99 * @param url A string containing the URL to which the request is sent.
100 * @param success A callback function that is executed if the request succeeds.
101 */
102 getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
103 /**
104 * Load JSON-encoded data from the server using a GET HTTP request.
105 *
106 * @param url A string containing the URL to which the request is sent.
107 * @param data A plain object or string that is sent to the server with the request.
108 * @param success A callback function that is executed if the request succeeds.
109 */
110 getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
111 /**
112 * Load a JavaScript file from the server using a GET HTTP request, then execute it.
113 *
114 * @param url A string containing the URL to which the request is sent.
115 * @param success A callback function that is executed if the request succeeds.
116 */
117 getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
118
119 /**
120 * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
121 */
122 param: JQueryParam;
123
124 /**
125 * Load data from the server using a HTTP POST request.
126 *
127 * @param url A string containing the URL to which the request is sent.
128 * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
129 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
130 */
131 post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
132 /**
133 * Load data from the server using a HTTP POST request.
134 *
135 * @param url A string containing the URL to which the request is sent.
136 * @param data A plain object or string that is sent to the server with the request.
137 * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
138 * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
139 */
140 post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
141
142 /**
143 * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
144 *
145 * @param flags An optional list of space-separated flags that change how the callback list behaves.
146 */
147 Callbacks(flags?: string): JQueryCallback;
148
149 /**
150 * Holds or releases the execution of jQuery's ready event.
151 *
152 * @param hold Indicates whether the ready hold is being requested or released
153 */
154 holdReady(hold: boolean): void;
155
156 /**
157 * Accepts a string containing a CSS selector which is then used to match a set of elements.
158 *
159 * @param selector A string containing a selector expression
160 * @param context A DOM Element, Document, or jQuery to use as context
161 */
162 (selector: string, context?: Element|JQuery): ChaiJQuery;
163 /**
164 * Accepts a string containing a CSS selector which is then used to match a set of elements.
165 *
166 * @param element A DOM element to wrap in a jQuery object.
167 */
168 (element: Element): ChaiJQuery;
169 /**
170 * Accepts a string containing a CSS selector which is then used to match a set of elements.
171 *
172 * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object.
173 */
174 (elementArray: Element[]): ChaiJQuery;
175 /**
176 * Accepts a string containing a CSS selector which is then used to match a set of elements.
177 *
178 * @param object A plain object to wrap in a jQuery object.
179 */
180 (object: {}): ChaiJQuery;
181 /**
182 * Accepts a string containing a CSS selector which is then used to match a set of elements.
183 *
184 * @param object An existing jQuery object to clone.
185 */
186 (object: JQuery): ChaiJQuery;
187 /**
188 * Specify a function to execute when the DOM is fully loaded.
189 */
190 (): ChaiJQuery;
191
192 /**
193 * Creates DOM elements on the fly from the provided string of raw HTML.
194 *
195 * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML.
196 * @param ownerDocument A document in which the new elements will be created.
197 */
198 (html: string, ownerDocument?: Document): ChaiJQuery;
199 /**
200 * Creates DOM elements on the fly from the provided string of raw HTML.
201 *
202 * @param html A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>).
203 * @param attributes An object of attributes, events, and methods to call on the newly-created element.
204 */
205 (html: string, attributes: Object): ChaiJQuery;
206
207 /**
208 * Binds a function to be executed when the DOM has finished loading.
209 *
210 * @param callback A function to execute after the DOM is ready.
211 */
212 (callback: Function): ChaiJQuery;
213
214 /**
215 * Relinquish jQuery's control of the $ variable.
216 *
217 * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
218 */
219 noConflict(removeAll?: boolean): Object;
220
221 /**
222 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
223 *
224 * @param deferreds One or more Deferred objects, or plain JavaScript objects.
225 */
226 when<T>(...deferreds: Array<T|JQueryPromise<T>/* as JQueryDeferred<T> */>): JQueryPromise<T>;
227
228 /**
229 * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
230 */
231 cssHooks: { [key: string]: any; };
232 cssNumber: any;
233
234 /**
235 * Store arbitrary data associated with the specified element. Returns the value that was set.
236 *
237 * @param element The DOM element to associate with the data.
238 * @param key A string naming the piece of data to set.
239 * @param value The new data value.
240 */
241 data<T>(element: Element, key: string, value: T): T;
242 /**
243 * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
244 *
245 * @param element The DOM element to associate with the data.
246 * @param key A string naming the piece of data to set.
247 */
248 data(element: Element, key: string): any;
249 /**
250 * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
251 *
252 * @param element The DOM element to associate with the data.
253 */
254 data(element: Element): any;
255
256 /**
257 * Execute the next function on the queue for the matched element.
258 *
259 * @param element A DOM element from which to remove and execute a queued function.
260 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
261 */
262 dequeue(element: Element, queueName?: string): void;
263
264 /**
265 * Determine whether an element has any jQuery data associated with it.
266 *
267 * @param element A DOM element to be checked for data.
268 */
269 hasData(element: Element): boolean;
270
271 /**
272 * Show the queue of functions to be executed on the matched element.
273 *
274 * @param element A DOM element to inspect for an attached queue.
275 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
276 */
277 queue(element: Element, queueName?: string): any[];
278 /**
279 * Manipulate the queue of functions to be executed on the matched element.
280 *
281 * @param element A DOM element where the array of queued functions is attached.
282 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
283 * @param newQueue An array of functions to replace the current queue contents.
284 */
285 queue(element: Element, queueName: string, newQueue: Function[]): ChaiJQuery;
286 /**
287 * Manipulate the queue of functions to be executed on the matched element.
288 *
289 * @param element A DOM element on which to add a queued function.
290 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
291 * @param callback The new function to add to the queue.
292 */
293 queue(element: Element, queueName: string, callback: Function): ChaiJQuery;
294
295 /**
296 * Remove a previously-stored piece of data.
297 *
298 * @param element A DOM element from which to remove data.
299 * @param name A string naming the piece of data to remove.
300 */
301 removeData(element: Element, name?: string): ChaiJQuery;
302
303 /**
304 * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
305 *
306 * @param beforeStart A function that is called just before the constructor returns.
307 */
308 Deferred<T>(beforeStart?: (deferred: JQueryDeferred<T>) => any): JQueryDeferred<T>;
309
310 /**
311 * Effects
312 */
313 fx: {
314 tick: () => void;
315 /**
316 * The rate (in milliseconds) at which animations fire.
317 */
318 interval: number;
319 stop: () => void;
320 speeds: { slow: number; fast: number; };
321 /**
322 * Globally disable all animations.
323 */
324 off: boolean;
325 step: any;
326 };
327
328 /**
329 * Takes a function and returns a new one that will always have a particular context.
330 *
331 * @param fnction The function whose context will be changed.
332 * @param context The object to which the context (this) of the function should be set.
333 * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument.
334 */
335 proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any;
336 /**
337 * Takes a function and returns a new one that will always have a particular context.
338 *
339 * @param context The object to which the context (this) of the function should be set.
340 * @param name The name of the function whose context will be changed (should be a property of the context object).
341 * @param additionalArguments Any number of arguments to be passed to the function named in the name argument.
342 */
343 proxy(context: Object, name: string, ...additionalArguments: any[]): any;
344
345 Event: JQueryEventConstructor;
346
347 /**
348 * Takes a string and throws an exception containing it.
349 *
350 * @param message The message to send out.
351 */
352 error(message: any): ChaiJQuery;
353
354 expr: any;
355 fn: any; //TODO: Decide how we want to type this
356
357 isReady: boolean;
358
359 // Properties
360 support: JQuerySupport;
361
362 /**
363 * Check to see if a DOM element is a descendant of another DOM element.
364 *
365 * @param container The DOM element that may contain the other element.
366 * @param contained The DOM element that may be contained by (a descendant of) the other element.
367 */
368 contains(container: Element, contained: Element): boolean;
369
370 /**
371 * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
372 *
373 * @param collection The object or array to iterate over.
374 * @param callback The function that will be executed on every object.
375 */
376 each<T>(
377 collection: T[],
378 callback: (indexInArray: number, valueOfElement: T) => any
379 ): any;
380
381 /**
382 * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
383 *
384 * @param collection The object or array to iterate over.
385 * @param callback The function that will be executed on every object.
386 */
387 each(
388 collection: any,
389 callback: (indexInArray: any, valueOfElement: any) => any
390 ): any;
391
392 /**
393 * Merge the contents of two or more objects together into the first object.
394 *
395 * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.
396 * @param object1 An object containing additional properties to merge in.
397 * @param objectN Additional objects containing properties to merge in.
398 */
399 extend(target: any, object1?: any, ...objectN: any[]): any;
400 /**
401 * Merge the contents of two or more objects together into the first object.
402 *
403 * @param deep If true, the merge becomes recursive (aka. deep copy).
404 * @param target The object to extend. It will receive the new properties.
405 * @param object1 An object containing additional properties to merge in.
406 * @param objectN Additional objects containing properties to merge in.
407 */
408 extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any;
409
410 /**
411 * Execute some JavaScript code globally.
412 *
413 * @param code The JavaScript code to execute.
414 */
415 globalEval(code: string): any;
416
417 /**
418 * Finds the elements of an array which satisfy a filter function. The original array is not affected.
419 *
420 * @param array The array to search through.
421 * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
422 * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
423 */
424 grep<T>(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[];
425
426 /**
427 * Search for a specified value within an array and return its index (or -1 if not found).
428 *
429 * @param value The value to search for.
430 * @param array An array through which to search.
431 * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array.
432 */
433 inArray<T>(value: T, array: T[], fromIndex?: number): number;
434
435 /**
436 * Determine whether the argument is an array.
437 *
438 * @param obj Object to test whether or not it is an array.
439 */
440 isArray(obj: any): boolean;
441 /**
442 * Check to see if an object is empty (contains no enumerable properties).
443 *
444 * @param obj The object that will be checked to see if it's empty.
445 */
446 isEmptyObject(obj: any): boolean;
447 /**
448 * Determine if the argument passed is a Javascript function object.
449 *
450 * @param obj Object to test whether or not it is a function.
451 */
452 isFunction(obj: any): boolean;
453 /**
454 * Determines whether its argument is a number.
455 *
456 * @param obj The value to be tested.
457 */
458 isNumeric(value: any): boolean;
459 /**
460 * Check to see if an object is a plain object (created using "{}" or "new Object").
461 *
462 * @param obj The object that will be checked to see if it's a plain object.
463 */
464 isPlainObject(obj: any): boolean;
465 /**
466 * Determine whether the argument is a window.
467 *
468 * @param obj Object to test whether or not it is a window.
469 */
470 isWindow(obj: any): boolean;
471 /**
472 * Check to see if a DOM node is within an XML document (or is an XML document).
473 *
474 * @param node The DOM node that will be checked to see if it's in an XML document.
475 */
476 isXMLDoc(node: Node): boolean;
477
478 /**
479 * Convert an array-like object into a true JavaScript array.
480 *
481 * @param obj Any object to turn into a native Array.
482 */
483 makeArray(obj: any): any[];
484
485 /**
486 * Translate all items in an array or object to new array of items.
487 *
488 * @param array The Array to translate.
489 * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object.
490 */
491 map<T, U>(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[];
492 /**
493 * Translate all items in an array or object to new array of items.
494 *
495 * @param arrayOrObject The Array or Object to translate.
496 * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.
497 */
498 map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any;
499
500 /**
501 * Merge the contents of two arrays together into the first array.
502 *
503 * @param first The first array to merge, the elements of second added.
504 * @param second The second array to merge into the first, unaltered.
505 */
506 merge<T>(first: T[], second: T[]): T[];
507
508 /**
509 * An empty function.
510 */
511 noop(): any;
512
513 /**
514 * Return a number representing the current time.
515 */
516 now(): number;
517
518 /**
519 * Takes a well-formed JSON string and returns the resulting JavaScript object.
520 *
521 * @param json The JSON string to parse.
522 */
523 parseJSON(json: string): any;
524
525 /**
526 * Parses a string into an XML document.
527 *
528 * @param data a well-formed XML string to be parsed
529 */
530 parseXML(data: string): XMLDocument;
531
532 /**
533 * Remove the whitespace from the beginning and end of a string.
534 *
535 * @param str Remove the whitespace from the beginning and end of a string.
536 */
537 trim(str: string): string;
538
539 /**
540 * Determine the internal JavaScript [[Class]] of an object.
541 *
542 * @param obj Object to get the internal JavaScript [[Class]] of.
543 */
544 type(obj: any): string;
545
546 /**
547 * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
548 *
549 * @param array The Array of DOM elements.
550 */
551 unique(array: Element[]): Element[];
552
553 /**
554 * Parses a string into an array of DOM nodes.
555 *
556 * @param data HTML string to be parsed
557 * @param context DOM element to serve as the context in which the HTML fragment will be created
558 * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
559 */
560 parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[];
561
562 /**
563 * Parses a string into an array of DOM nodes.
564 *
565 * @param data HTML string to be parsed
566 * @param context DOM element to serve as the context in which the HTML fragment will be created
567 * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string
568 */
569 parseHTML(data: string, context?: Document, keepScripts?: boolean): any[];
570}
571
572/**
573 * The chai-jquery instance members
574 */
575interface ChaiJQuery {
576 /**
577 * Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
578 *
579 * @param handler The function to be invoked.
580 */
581 ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): ChaiJQuery;
582 /**
583 * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
584 *
585 * @param handler The function to be invoked.
586 */
587 ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): ChaiJQuery;
588 /**
589 * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
590 *
591 * @param handler The function to be invoked.
592 */
593 ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery;
594 /**
595 * Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
596 *
597 * @param handler The function to be invoked.
598 */
599 ajaxStart(handler: () => any): ChaiJQuery;
600 /**
601 * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
602 *
603 * @param handler The function to be invoked.
604 */
605 ajaxStop(handler: () => any): ChaiJQuery;
606 /**
607 * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
608 *
609 * @param handler The function to be invoked.
610 */
611 ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery;
612
613 /**
614 * Load data from the server and place the returned HTML into the matched element.
615 *
616 * @param url A string containing the URL to which the request is sent.
617 * @param data A plain object or string that is sent to the server with the request.
618 * @param complete A callback function that is executed when the request completes.
619 */
620 load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): ChaiJQuery;
621
622 /**
623 * Encode a set of form elements as a string for submission.
624 */
625 serialize(): string;
626 /**
627 * Encode a set of form elements as an array of names and values.
628 */
629 serializeArray(): JQuerySerializeArrayElement[];
630
631 /**
632 * Adds the specified class(es) to each of the set of matched elements.
633 *
634 * @param className One or more space-separated classes to be added to the class attribute of each matched element.
635 */
636 addClass(className: string): ChaiJQuery;
637 /**
638 * Adds the specified class(es) to each of the set of matched elements.
639 *
640 * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set.
641 */
642 addClass(func: (index: number, className: string) => string): ChaiJQuery;
643
644 /**
645 * Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
646 */
647 addBack(selector?: string): ChaiJQuery;
648
649 /**
650 * Get the value of an attribute for the first element in the set of matched elements.
651 *
652 * @param attributeName The name of the attribute to get.
653 */
654 attr(attributeName: string): string;
655 /**
656 * Set one or more attributes for the set of matched elements.
657 *
658 * @param attributeName The name of the attribute to set.
659 * @param value A value to set for the attribute.
660 */
661 attr(attributeName: string, value: string|number): ChaiJQuery;
662 /**
663 * Set one or more attributes for the set of matched elements.
664 *
665 * @param attributeName The name of the attribute to set.
666 * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments.
667 */
668 attr(attributeName: string, func: (index: number, attr: string) => string|number): ChaiJQuery;
669 /**
670 * Set one or more attributes for the set of matched elements.
671 *
672 * @param attributes An object of attribute-value pairs to set.
673 */
674 attr(attributes: Object): ChaiJQuery;
675
676 /**
677 * Determine whether any of the matched elements are assigned the given class.
678 *
679 * @param className The class name to search for.
680 */
681 hasClass(className: string): boolean;
682
683 /**
684 * Get the HTML contents of the first element in the set of matched elements.
685 */
686 html(): string;
687 /**
688 * Set the HTML contents of each element in the set of matched elements.
689 *
690 * @param htmlString A string of HTML to set as the content of each matched element.
691 */
692 html(htmlString: string): ChaiJQuery;
693 /**
694 * Set the HTML contents of each element in the set of matched elements.
695 *
696 * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
697 */
698 html(func: (index: number, oldhtml: string) => string): ChaiJQuery;
699 /**
700 * Set the HTML contents of each element in the set of matched elements.
701 *
702 * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
703 */
704
705 /**
706 * Get the value of a property for the first element in the set of matched elements.
707 *
708 * @param propertyName The name of the property to get.
709 */
710 prop(propertyName: string): any;
711 /**
712 * Set one or more properties for the set of matched elements.
713 *
714 * @param propertyName The name of the property to set.
715 * @param value A value to set for the property.
716 */
717 prop(propertyName: string, value: string|number|boolean): ChaiJQuery;
718 /**
719 * Set one or more properties for the set of matched elements.
720 *
721 * @param properties An object of property-value pairs to set.
722 */
723 prop(properties: Object): ChaiJQuery;
724 /**
725 * Set one or more properties for the set of matched elements.
726 *
727 * @param propertyName The name of the property to set.
728 * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
729 */
730 prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): ChaiJQuery;
731
732 /**
733 * Remove an attribute from each element in the set of matched elements.
734 *
735 * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
736 */
737 removeAttr(attributeName: string): ChaiJQuery;
738
739 /**
740 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
741 *
742 * @param className One or more space-separated classes to be removed from the class attribute of each matched element.
743 */
744 removeClass(className?: string): ChaiJQuery;
745 /**
746 * Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
747 *
748 * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.
749 */
750 removeClass(func: (index: number, className: string) => string): ChaiJQuery;
751
752 /**
753 * Remove a property for the set of matched elements.
754 *
755 * @param propertyName The name of the property to remove.
756 */
757 removeProp(propertyName: string): ChaiJQuery;
758
759 /**
760 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
761 *
762 * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
763 * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
764 */
765 toggleClass(className: string, swtch?: boolean): ChaiJQuery;
766 /**
767 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
768 *
769 * @param swtch A boolean value to determine whether the class should be added or removed.
770 */
771 toggleClass(swtch?: boolean): ChaiJQuery;
772 /**
773 * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
774 *
775 * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments.
776 * @param swtch A boolean value to determine whether the class should be added or removed.
777 */
778 toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): ChaiJQuery;
779
780 /**
781 * Get the current value of the first element in the set of matched elements.
782 */
783 val(): any;
784 /**
785 * Set the value of each element in the set of matched elements.
786 *
787 * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
788 */
789 val(value: string|string[]): ChaiJQuery;
790 /**
791 * Set the value of each element in the set of matched elements.
792 *
793 * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
794 */
795 val(func: (index: number, value: string) => string): ChaiJQuery;
796
797
798 /**
799 * Get the value of style properties for the first element in the set of matched elements.
800 *
801 * @param propertyName A CSS property.
802 */
803 css(propertyName: string): string;
804 /**
805 * Set one or more CSS properties for the set of matched elements.
806 *
807 * @param propertyName A CSS property name.
808 * @param value A value to set for the property.
809 */
810 css(propertyName: string, value: string|number): ChaiJQuery;
811 /**
812 * Set one or more CSS properties for the set of matched elements.
813 *
814 * @param propertyName A CSS property name.
815 * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
816 */
817 css(propertyName: string, value: (index: number, value: string) => string|number): ChaiJQuery;
818 /**
819 * Set one or more CSS properties for the set of matched elements.
820 *
821 * @param properties An object of property-value pairs to set.
822 */
823 css(properties: Object): ChaiJQuery;
824
825 /**
826 * Get the current computed height for the first element in the set of matched elements.
827 */
828 height(): number;
829 /**
830 * Set the CSS height of every matched element.
831 *
832 * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).
833 */
834 height(value: number|string): ChaiJQuery;
835 /**
836 * Set the CSS height of every matched element.
837 *
838 * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set.
839 */
840 height(func: (index: number, height: number) => number|string): ChaiJQuery;
841
842 /**
843 * Get the current computed height for the first element in the set of matched elements, including padding but not border.
844 */
845 innerHeight(): number;
846
847 /**
848 * Sets the inner height on elements in the set of matched elements, including padding but not border.
849 *
850 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
851 */
852 innerHeight(height: number|string): ChaiJQuery;
853
854 /**
855 * Get the current computed width for the first element in the set of matched elements, including padding but not border.
856 */
857 innerWidth(): number;
858
859 /**
860 * Sets the inner width on elements in the set of matched elements, including padding but not border.
861 *
862 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
863 */
864 innerWidth(width: number|string): ChaiJQuery;
865
866 /**
867 * Get the current coordinates of the first element in the set of matched elements, relative to the document.
868 */
869 offset(): JQueryCoordinates;
870 /**
871 * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
872 *
873 * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
874 */
875 offset(coordinates: JQueryCoordinates): ChaiJQuery;
876 /**
877 * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
878 *
879 * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties.
880 */
881 offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): ChaiJQuery;
882
883 /**
884 * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements.
885 *
886 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
887 */
888 outerHeight(includeMargin?: boolean): number;
889
890 /**
891 * Sets the outer height on elements in the set of matched elements, including padding and border.
892 *
893 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
894 */
895 outerHeight(height: number|string): ChaiJQuery;
896
897 /**
898 * Get the current computed width for the first element in the set of matched elements, including padding and border.
899 *
900 * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation.
901 */
902 outerWidth(includeMargin?: boolean): number;
903
904 /**
905 * Sets the outer width on elements in the set of matched elements, including padding and border.
906 *
907 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
908 */
909 outerWidth(width: number|string): ChaiJQuery;
910
911 /**
912 * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
913 */
914 position(): JQueryCoordinates;
915
916 /**
917 * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element.
918 */
919 scrollLeft(): number;
920 /**
921 * Set the current horizontal position of the scroll bar for each of the set of matched elements.
922 *
923 * @param value An integer indicating the new position to set the scroll bar to.
924 */
925 scrollLeft(value: number): ChaiJQuery;
926
927 /**
928 * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
929 */
930 scrollTop(): number;
931 /**
932 * Set the current vertical position of the scroll bar for each of the set of matched elements.
933 *
934 * @param value An integer indicating the new position to set the scroll bar to.
935 */
936 scrollTop(value: number): ChaiJQuery;
937
938 /**
939 * Get the current computed width for the first element in the set of matched elements.
940 */
941 width(): number;
942 /**
943 * Set the CSS width of each element in the set of matched elements.
944 *
945 * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
946 */
947 width(value: number|string): ChaiJQuery;
948 /**
949 * Set the CSS width of each element in the set of matched elements.
950 *
951 * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set.
952 */
953 width(func: (index: number, width: number) => number|string): ChaiJQuery;
954
955 /**
956 * Remove from the queue all items that have not yet been run.
957 *
958 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
959 */
960 clearQueue(queueName?: string): ChaiJQuery;
961
962 /**
963 * Store arbitrary data associated with the matched elements.
964 *
965 * @param key A string naming the piece of data to set.
966 * @param value The new data value; it can be any Javascript type including Array or Object.
967 */
968 data(key: string, value: any): ChaiJQuery;
969 /**
970 * Store arbitrary data associated with the matched elements.
971 *
972 * @param obj An object of key-value pairs of data to update.
973 */
974 data(obj: { [key: string]: any; }): ChaiJQuery;
975 /**
976 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
977 *
978 * @param key Name of the data stored.
979 */
980 data(key: string): any;
981 /**
982 * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
983 */
984 data(): any;
985
986 /**
987 * Execute the next function on the queue for the matched elements.
988 *
989 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
990 */
991 dequeue(queueName?: string): ChaiJQuery;
992
993 /**
994 * Remove a previously-stored piece of data.
995 *
996 * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
997 */
998 removeData(name: string): ChaiJQuery;
999 /**
1000 * Remove a previously-stored piece of data.
1001 *
1002 * @param list An array of strings naming the pieces of data to delete.
1003 */
1004 removeData(list: string[]): ChaiJQuery;
1005
1006 /**
1007 * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
1008 *
1009 * @param type The type of queue that needs to be observed. (default: fx)
1010 * @param target Object onto which the promise methods have to be attached
1011 */
1012 promise(type?: string, target?: Object): JQueryPromise<any>;
1013
1014 /**
1015 * Perform a custom animation of a set of CSS properties.
1016 *
1017 * @param properties An object of CSS properties and values that the animation will move toward.
1018 * @param duration A string or number determining how long the animation will run.
1019 * @param complete A function to call once the animation is complete.
1020 */
1021 animate(properties: Object, duration?: string|number, complete?: Function): ChaiJQuery;
1022 /**
1023 * Perform a custom animation of a set of CSS properties.
1024 *
1025 * @param properties An object of CSS properties and values that the animation will move toward.
1026 * @param duration A string or number determining how long the animation will run.
1027 * @param easing A string indicating which easing function to use for the transition. (default: swing)
1028 * @param complete A function to call once the animation is complete.
1029 */
1030 animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): ChaiJQuery;
1031 /**
1032 * Perform a custom animation of a set of CSS properties.
1033 *
1034 * @param properties An object of CSS properties and values that the animation will move toward.
1035 * @param options A map of additional options to pass to the method.
1036 */
1037 animate(properties: Object, options: JQueryAnimationOptions): ChaiJQuery;
1038
1039 /**
1040 * Set a timer to delay execution of subsequent items in the queue.
1041 *
1042 * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue.
1043 * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.
1044 */
1045 delay(duration: number, queueName?: string): ChaiJQuery;
1046
1047 /**
1048 * Display the matched elements by fading them to opaque.
1049 *
1050 * @param duration A string or number determining how long the animation will run.
1051 * @param complete A function to call once the animation is complete.
1052 */
1053 fadeIn(duration?: number|string, complete?: Function): ChaiJQuery;
1054 /**
1055 * Display the matched elements by fading them to opaque.
1056 *
1057 * @param duration A string or number determining how long the animation will run.
1058 * @param easing A string indicating which easing function to use for the transition.
1059 * @param complete A function to call once the animation is complete.
1060 */
1061 fadeIn(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery;
1062 /**
1063 * Display the matched elements by fading them to opaque.
1064 *
1065 * @param options A map of additional options to pass to the method.
1066 */
1067 fadeIn(options: JQueryAnimationOptions): ChaiJQuery;
1068
1069 /**
1070 * Hide the matched elements by fading them to transparent.
1071 *
1072 * @param duration A string or number determining how long the animation will run.
1073 * @param complete A function to call once the animation is complete.
1074 */
1075 fadeOut(duration?: number|string, complete?: Function): ChaiJQuery;
1076 /**
1077 * Hide the matched elements by fading them to transparent.
1078 *
1079 * @param duration A string or number determining how long the animation will run.
1080 * @param easing A string indicating which easing function to use for the transition.
1081 * @param complete A function to call once the animation is complete.
1082 */
1083 fadeOut(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery;
1084 /**
1085 * Hide the matched elements by fading them to transparent.
1086 *
1087 * @param options A map of additional options to pass to the method.
1088 */
1089 fadeOut(options: JQueryAnimationOptions): ChaiJQuery;
1090
1091 /**
1092 * Adjust the opacity of the matched elements.
1093 *
1094 * @param duration A string or number determining how long the animation will run.
1095 * @param opacity A number between 0 and 1 denoting the target opacity.
1096 * @param complete A function to call once the animation is complete.
1097 */
1098 fadeTo(duration: string|number, opacity: number, complete?: Function): ChaiJQuery;
1099 /**
1100 * Adjust the opacity of the matched elements.
1101 *
1102 * @param duration A string or number determining how long the animation will run.
1103 * @param opacity A number between 0 and 1 denoting the target opacity.
1104 * @param easing A string indicating which easing function to use for the transition.
1105 * @param complete A function to call once the animation is complete.
1106 */
1107 fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): ChaiJQuery;
1108
1109 /**
1110 * Display or hide the matched elements by animating their opacity.
1111 *
1112 * @param duration A string or number determining how long the animation will run.
1113 * @param complete A function to call once the animation is complete.
1114 */
1115 fadeToggle(duration?: number|string, complete?: Function): ChaiJQuery;
1116 /**
1117 * Display or hide the matched elements by animating their opacity.
1118 *
1119 * @param duration A string or number determining how long the animation will run.
1120 * @param easing A string indicating which easing function to use for the transition.
1121 * @param complete A function to call once the animation is complete.
1122 */
1123 fadeToggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery;
1124 /**
1125 * Display or hide the matched elements by animating their opacity.
1126 *
1127 * @param options A map of additional options to pass to the method.
1128 */
1129 fadeToggle(options: JQueryAnimationOptions): ChaiJQuery;
1130
1131 /**