diff --git a/mozmill/mozmill/extension/resource/modules/controller.js b/mozmill/mozmill/extension/resource/modules/controller.js index 4ee38505..3a520bac 100644 --- a/mozmill/mozmill/extension/resource/modules/controller.js +++ b/mozmill/mozmill/extension/resource/modules/controller.js @@ -782,40 +782,29 @@ MozMillController.prototype.assertProperty = function(el, attrib, val) { return false; } var value = eval('element.' + attrib + ';'); - var res = (element.hasAttribute(attrib) && (val == undefined ? true : String(value) == String(val))); + var res = (String(value) == String(val)); if (res) { frame.events.pass({'function':'Controller.assertProperty("' + el.getInfo() + '") : ' + val}); } else { - throw new Error("Controller.assertProperty(" + el.getInfo() + ") : " + - (val == undefined ? "property '" + attrib + "' doesn't exist" : val + " == " + value)); + throw new Error("Controller.assertProperty(" + el.getInfo() + ") : " + val + " == " + value); } return res; }; -// Assert that an element's property doesn't have a particular value -MozMillController.prototype.assertNotProperty = function(el, attrib, val) { +// Assert that an element's property does not exist +MozMillController.prototype.assertPropertyNotExist = function(el, attrib) { var element = el.getNode(); - if (!element){ + if (!element) { throw new Error("could not find element " + el.getInfo()); - return false; + return false; } - var value = eval('element.' + attrib + ';'); - var res = (val == undefined ? !element.hasAttribute(attrib) : String(value) != String(val)); - if (res) { - frame.events.pass({'function':'Controller.assertNotProperty("' + el.getInfo() + '") : ' + val}); - } else { - throw new Error("Controller.assertProperty(" + el.getInfo() + ") : " + - (val == undefined ? "property '" + attrib + "' exists" : val + " != " + value)); + if (!element.hasAttribute(attrib)) { + frame.events.pass({'function':'Controller.assertPropertyNotExist()'}); + return true; } - - return res; -}; - -// deprecated - Use assertNotProperty instead -MozMillController.prototype.assertPropertyNotExist = function(el, attrib) { - frame.log({function:'assertPropertyNotExist(el, attrib) - Deprecation Warning', message:'use assertNotProperty(el, attrib) instead'}); - return this.assertNotProperty(el, attrib); + throw new Error("assert failed for checked element " + el.getInfo()); + return false; }; // Assert that a specified image has actually loaded