ABPCMS.Web/lib/sweetalert/test/tests.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// swal() sould add the modal to the DOM + make it visible
test("modal shows up", function() {
equal($('.sweet-alert').length, 0);
swal("Hello world!");
ok($('.sweet-alert').is(':visible'));
});
// Clicking the confirm-button should dismiss the modal
test("dismiss modal with confirm-button", function(assert) {
var done = assert.async();
swal("Dismiss me");
var $modal = $('.sweet-alert');
$modal.find('button.confirm').click();
setTimeout(function() {
assert.ok($modal.is(':hidden'));
done();
}, 500);
});
test("dismiss modal with esc-key", function(assert) {
var done = assert.async();
swal("Dismiss me");
var $modal = $('.sweet-alert');
$(document).trigger($.Event('keydown', {
keyCode: 27
}));
setTimeout(function() {
assert.ok($modal.is(':hidden'));
done();
}, 500);
});
test("modals stays on with esc-key if allowEscapeKey is false", function(assert) {
var done = assert.async();
swal({
title: "Dismiss me",
allowEscapeKey: false
});
var $modal = $('.sweet-alert');
$(document).trigger($.Event('keydown', {
keyCode: 27
}));
setTimeout(function() {
assert.ok($modal.is(':visible'));
done();
}, 500);
});
/*
* Make sure that when using { showCancelButton: true }:
* - The cancel-button is visible on the modal
* - Clicking on it dismisses the modal
后面还有 81 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
