Wordpress/tests/qunit/editor/tinymce/ui/TextBox.html

60 lines
1.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ui.TextBox Test Suite</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">
QUnit.config.autostart = false;
QUnit.config.reorder = false;
module("ui.TextBox", {
setup: function() {
document.getElementById('view').innerHTML = '';
},
teardown: function() {
//document.getElementById('view').innerHTML = '';
}
});
window.onload = function() {
QUnit.start();
};
function createTextBox(settings) {
return tinymce.ui.Factory.create(tinymce.extend({
type: 'textbox'
}, settings)).renderTo(document.getElementById('view'));
}
test("textbox text, size chars: 5", function() {
var textBox = createTextBox({text: 'X', size: 5});
nearlyEqualRects(size(textBox), [69, 30], 20);
});
test("textbox text, size 100x100", function() {
var textBox = createTextBox({text: 'X', width: 100, height: 100});
deepEqual(size(textBox), [100, 100]);
});
</script>
</head>
<body>
<h1 id="qunit-header">ui.TextBox Test Suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="view" style="position: absolute; right: 0; top: 0"></div>
</body>
</html>