Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Revert "Bug 583773 - Add assertNotProperty to controller API"
Browse files Browse the repository at this point in the history
This reverts commit 2260516.
  • Loading branch information
whimboo committed Aug 3, 2010
1 parent 21ea6a3 commit 4a8cd09
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions mozmill/mozmill/extension/resource/modules/controller.js
Expand Up @@ -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
Expand Down

0 comments on commit 4a8cd09

Please sign in to comment.