/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
module("ui");
var kExampleResultsByTest = {
"scrollbars/custom-scrollbar-with-incomplete-style.html": {
"Mock Builder": {
"expected": "IMAGE",
"actual": "CRASH"
},
"Mock Linux": {
"expected": "TEXT",
"actual": "CRASH"
}
},
"userscripts/another-test.html": {
"Mock Builder": {
"expected": "PASS",
"actual": "TEXT"
}
}
}
test("ui.onebar", 3, function() {
if (window.location.hash) {
window.location.hash = '';
}
onebar = new ui.onebar();
onebar.attach();
equal(onebar.innerHTML,
'
');
});
test("results.ResultsGrid (crashlog)", 1, function() {
var grid = new ui.results.ResultsGrid()
grid.addResults(['http://example.com/layout-test-results/foo-bar-crash-log.txt']);
equal(grid.innerHTML, '');
});
test("results.ResultsGrid (empty)", 1, function() {
var grid = new ui.results.ResultsGrid()
grid.addResults([]);
equal(grid.innerHTML, 'No results to display.');
});
test("time", 6, function() {
var time = new ui.RelativeTime();
equal(time.tagName, 'TIME');
equal(time.className, 'relative');
deepEqual(Object.getOwnPropertyNames(time.__proto__).sort(), [
'date',
'init',
'setDate',
'update',
]);
equal(time.outerHTML, '');
var tenMinutesAgo = new Date();
tenMinutesAgo.setMinutes(tenMinutesAgo.getMinutes() - 10);
time.setDate(tenMinutesAgo);
equal(time.outerHTML, '');
equal(time.date().getTime(), tenMinutesAgo.getTime());
});
test("StatusArea", 3, function() {
var statusArea = new ui.StatusArea();
var id = statusArea.newId();
statusArea.addMessage(id, 'First Message');
statusArea.addMessage(id, 'Second Message');
equal(statusArea.outerHTML,
'
' +
'
' +
'' +
'
' +
'
First Message
' +
'
Second Message
' +
'
' +
'
');
var secondStatusArea = new ui.StatusArea();
var secondId = secondStatusArea.newId();
secondStatusArea.addMessage(secondId, 'First Message second id');
equal(statusArea.outerHTML,
'