119 lines
2.9 KiB
HTML
119 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>ui.Window</title>
|
|
<link type="text/css" rel="stylesheet" href="../../../../../src/wp-includes/js/tinymce/skins/lightgray/skin.min.css" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
|
|
<link rel="stylesheet" href="css/ui-overrides.css" type="text/css" />
|
|
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" />
|
|
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
|
|
<script src="../../js/qunit/reporter.js"></script>
|
|
<script src="../../js/utils.js"></script>
|
|
<script src="../../js/tinymce_loader.js"></script>
|
|
<script type="text/javascript">
|
|
var win;
|
|
|
|
QUnit.config.autostart = false;
|
|
QUnit.config.reorder = false;
|
|
|
|
module("ui.Window", {
|
|
setup: function() {
|
|
document.getElementById('view').innerHTML = '';
|
|
},
|
|
|
|
teardown: function() {
|
|
tinymce.DOM.remove(document.getElementById('mce-modal-block'));
|
|
}
|
|
});
|
|
|
|
window.onload = function() {
|
|
QUnit.start();
|
|
};
|
|
|
|
function createWindow(settings) {
|
|
return tinymce.ui.Factory.create(tinymce.extend({
|
|
type: 'window'
|
|
}, settings)).renderTo(document.getElementById('view')).reflow();
|
|
}
|
|
|
|
test("window x, y, w, h", function() {
|
|
win = createWindow({x: 100, y: 120, width: 200, height: 210});
|
|
|
|
deepEqual(size(win), [200, 210]);
|
|
});
|
|
|
|
test("no title, no buttonbar, autoResize", function() {
|
|
win = createWindow({
|
|
x: 100,
|
|
y: 120,
|
|
items: [
|
|
{type: 'spacer', classes: 'red'}
|
|
]
|
|
});
|
|
|
|
deepEqual(size(win), [22, 22]);
|
|
deepEqual(size(win.find("spacer")[0]), [20, 20]);
|
|
});
|
|
|
|
test("title, no buttonbar, autoResize, title is widest", function() {
|
|
win = createWindow({
|
|
x: 100,
|
|
y: 120,
|
|
title: "XXXXXXXXXXXXXXXXXXXXXX",
|
|
items: [
|
|
{type: 'spacer', classes: 'red', flex: 1}
|
|
]
|
|
});
|
|
|
|
nearlyEqualRects(size(win), [326, 61], 10);
|
|
nearlyEqualRects(size(win.find("spacer")[0]), [324, 20], 10);
|
|
});
|
|
|
|
test("buttonbar, autoResize, buttonbar is widest", function() {
|
|
win = createWindow({
|
|
x: 100,
|
|
y: 120,
|
|
items: [
|
|
{type: 'spacer', classes: 'red', flex: 1}
|
|
],
|
|
buttons: [
|
|
{type: 'spacer', classes: 'green', minWidth: 400}
|
|
]
|
|
});
|
|
|
|
deepEqual(size(win), [422, 63]);
|
|
deepEqual(size(win.find("spacer")[0]), [420, 20]);
|
|
deepEqual(size(win.statusbar.find("spacer")[0]), [400, 20]);
|
|
});
|
|
|
|
test("buttonbar, title, autoResize, content is widest", function() {
|
|
win = createWindow({
|
|
x: 100,
|
|
y: 120,
|
|
title: "X",
|
|
items: [
|
|
{type: 'spacer', classes: 'red', minWidth: 400}
|
|
],
|
|
buttons: [
|
|
{type: 'spacer', classes: 'green'}
|
|
]
|
|
});
|
|
|
|
deepEqual(size(win), [402, 102]);
|
|
deepEqual(size(win.getEl("head")), [400, 39]);
|
|
deepEqual(size(win.find("spacer")[0]), [400, 20]);
|
|
deepEqual(size(win.statusbar.find("spacer")[0]), [20, 20]);
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1 id="qunit-header">ui.Window Test Suite</h1>
|
|
<h2 id="qunit-banner"></h2>
|
|
<h2 id="qunit-userAgent"></h2>
|
|
<ol id="qunit-tests">
|
|
</ol>
|
|
<div id="view" style="position: absolute; left: 0; top: 0"></div>
|
|
</body>
|
|
</html>
|