DefinitelyTyped/jquery-easy-loading/jquery-easy-loading-tests.ts
delphinus 4248215ed4 Add factory for module
package `jquery-easy-loading` will return a factory for the library
itself if you use this not in the browser env.
2016-03-06 11:27:38 +09:00

49 lines
1.3 KiB
TypeScript

/// <reference path="jquery-easy-loading.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
function test_options() {
const jqElement: JQuery = $("body").loading({
overlay: $(".some-class"),
zIndex: 1000,
message: "some message",
theme: "some theme",
shownClass: "some-class",
hiddenClass: "some-class",
stoppable: true,
start: true,
onStart: (loading: JQueryEasyLoading.LoadingObject) => console.log("starting"),
onStop: (loading: JQueryEasyLoading.LoadingObject) => console.log("stopping"),
onClick: (someVar1: any, someVar2: any) => console.log("some message"),
});
const jqLoading: JQueryEasyLoading.LoadingObject = $("body").Loading({
message: "some message",
});
}
function test_static() {
$.Loading.setDefaults({
message: "some message",
});
}
function test_commands() {
$('body')
.loading("resize")
.loading("start")
.loading("stop")
.loading("toggle");
}
import * as jQuery from "jquery";
import * as factory from "jquery-easy-loading";
function test_factory() {
const $loading: JQueryStatic = factory(window, jQuery);
$loading("body").loading("start");
}