blob: 64fac122c3bf4ff327975734329da9ce2888ef3a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../webdriver-bootstrap.js"></script>
<script src="deps.js"></script>
<script type="text/javascript" src="../scripts/htmlutils.js"></script>
<script type="text/javascript" src="../scripts/selenium-logging.js"></script>
<script type="text/javascript" src="../scripts/selenium-browserbot.js"></script>
<script type="text/javascript">
goog.require('bot.dom');
goog.require('core.firefox');
goog.require('goog.testing.jsunit');
</script>
<script type="text/javascript">
var browserVersion = {};
var browserbot;
function setUp() {
browserbot = new MozillaBrowserBot(window);
}
function assertStyleIs(locator, expectedStyle) {
var actualStyle = browserbot.findAttribute(locator, 'style');
if (expectedStyle == null) {
assertNull(actualStyle);
} else {
assertEquals(expectedStyle, actualStyle);
}
}
function testStyleAttributeReturnsCssText() {
assertStyleIs('id=child@style', 'visibility: inherit;');
}
function testStyleAttributeReturnsWithTrailingSemicolon() {
assertStyleIs('id=parent@style', 'visibility: visible;');
}
// TODO(simon): Renable this test
function xtestShouldReturnNullIfElementDoesNotHaveAStyleAttribute() {
assertStyleIs('xpath=//body@style', null);
}
// TODO(simon): Renable this test
function xtestShouldReturnNullIfElementHasAnEmptyStyleAttribute() {
assertStyleIs('id=empty-style@style', null);
}
function testEmptyAttributesShouldNotBeInterpretedAsBeingNull() {
var value = browserbot.findAttribute("id=hasAttributes@emptyAttr");
assertTrue(value === '');
}
function testShouldReturnNullWhenElementsAreMissing() {
var value = browserbot.findAttribute("id=hasAttributes@nope");
assertTrue(goog.isNull(value));
}
</script>
<style type="text/css">
#child {
height: 20px
}
</style>
</head>
<body> <!-- DO NOT PUT A STYLE ATTRIBUTE ON BODY! -->
<div id="empty-style" style="">i have no style!</div>
<div id="parent" style="visibility: visible">A parent div
<div id="child" style="visibility: inherit;display:;">A child div</div>
</div>
<span id="hasAttributes" emptyAttr="">This is a span</span>
</body>
</html>