updated tests

This commit is contained in:
John Papa
2012-12-24 12:23:00 -05:00
committed by Damiano
parent 3b84ce931f
commit b920d8a7f1
2 changed files with 15 additions and 57 deletions

View File

@@ -1,48 +0,0 @@
// Type definitions for Toastr 1.0
// Project: https://github.com/CodeSeven/toastr
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery-1.8.d.ts" />
interface ToastrOptions {
tapToDismiss?: bool;
toastClass?: string;
containerId?: string;
debug?: bool;
fadeIn?: number;
fadeOut?: number;
extendedTimeOut?: number;
iconClasses?: {
error: string;
info: string;
success: string;
warning: string;
};
iconClass?: string;
positionClass?: string;
timeOut?: number;
titleClass?: string;
messageClass?: string;
onclick?: () => void;
}
interface ToastrDisplayMethod {
(message: string): JQuery;
(message: string, title: string): JQuery;
(message: string, title: string, overrides: ToastrOptions): JQuery;
}
interface Toastr {
options: ToastrOptions;
clear(): void;
info: ToastrDisplayMethod;
warning: ToastrDisplayMethod;
success: ToastrDisplayMethod;
error: ToastrDisplayMethod;
}
declare var toastr: Toastr;

View File

@@ -1,17 +1,18 @@
/// <reference path="toastr-1.0.d.ts" />
/// <reference path="toastr-1.2.d.ts" />
function test_basic() {
toastr.info('Are you the 6 fingered man?');
toastr.warning('My name is Inigo Montoya. You Killed my father, prepare to die!');
toastr.success('Have fun storming the castle!', 'Miracle Max Says');
toastr.error('I do not think that word means what you tink it means.', 'Inconceivable!');
toastr.clear();
var t = [];
t.push(toastr.info('Are you the 6 fingered man?'));
t.push(toastr.warning('My name is Inigo Montoya. You Killed my father, prepare to die!'));
t.push(toastr.success('Have fun storming the castle!', 'Miracle Max Says'));
t.push(toastr.error('I do not think that word means what you think it means.', 'Inconceivable!'));
toastr.clear(t[0]); // clear 1
toastr.clear(); // clear all
var msg = 'Do you think Rodents of Unusual Size really exist?';
var title = 'Fireswamp Legends';
var overrides = { timeOut: 250 };
toastr.warning(msg, title, overrides);
toastr.options.onclick = function () { }
}
@@ -55,6 +56,11 @@ function test_fromdemo() {
alert('Surprise! you clicked me. i was toast #' + toastIndex + '. You could perform an action here.')
})
}
});
});
$('#clearlasttoast').click(function() {
toastr.clear($toastlast);
});
$('#cleartoasts').click(function () {
toastr.clear();
});
}