User:Ajkerrigan

From MozillaWiki
Jump to: navigation, search

I have been working on DevTools bugs lately, and while reading up on tests (https://wiki.mozilla.org/DevTools/mochitests_coding_standards) I noticed an error in the code. I figure why not fix it if I'm here anyway, right?

Just to be clear, the code line "yield desc.makeChanges()" below should be changed to "yield step.makeChanges()".

const TESTS = [
  {desc: "add a class", cssSelector: "#id1", makeChanges: function*() {...}},
  {desc: "change href", cssSelector: "a.the-link", makeChanges: function*() {...}},
  ...
];

add_task(function*() {
  yield addTab("...");
  let {toolbox, inspector} = yield openInspector();
  for (let step of TESTS) {
    info("Testing step: " + step.desc);
    yield selectNode(desc.cssSelector, inspector);
    yield desc.makeChanges();
  }
});