Opened 11 years ago

Last modified 6 years ago

#13172 new defect

PasswordValidator unit test broken

Reported by: bill Owned by: dante
Priority: high Milestone: 1.15
Component: DojoX Form Version: 1.6.1
Keywords: dohfail Cc:
Blocked By: Blocking:


On trunk or 1.6 branch, loading test_PasswordValidator.html on FF3.6 runs the automated test and gets all failures.

Change History (7)

comment:1 Changed 11 years ago by Colin Snover

Due to changeset [25648]. Mentioned at It would be easy enough to fix the problem if there was a way to provide a hash map from _getValueAttr that could be merged into the form values instead of being treated as a sub-object; dunno if this is a possibility right now or not.

comment:2 Changed 11 years ago by Colin Snover

Also due to changeset [23172]; this code relies on a parent _getValueAttr returning the value.

comment:3 Changed 11 years ago by bill

(In [25764]) Fix regression from [23172], PasswordValidator._getValueAttr() was calling this.inherited() but _FormValueWidget no longer has a _getValueAttr() method. This makes PasswordValidator.get("value") work as before, returning a String for the new password, although it's debatable whether it should instead return a hash with new and old passwords. Refs #11251, #13172 !strict.

comment:4 Changed 11 years ago by bill

(In [25767]) add hints, refs #13172. would be better though to use dojo.toJson() and compare strings, rather than comparing objects, to avoid mysterious error messages like "expecting [Object] but got [Object]"

comment:5 Changed 11 years ago by bill

Keywords: dohfail added
Summary: PasswordValidator brokenPasswordValidator unit test broken

So the big issue here is that PasswordValidator expects some unusual behavior from dijit.form.Form. It's probably better to modify PasswordValidator rather than trying to twist dijit.form.Form to work with it.

First, PasswordValidator wants to act as a form widget: it has isValid() etc. methods and it wants a parent dijit.form.Form to become invalid when the PasswordValidator child is invalid. Note that this functionality is probably broken now too because dijit.form.Form monitors child.state (via watch()) to tell when a child is valid/invalid, and when it changes validity. And I doubt PasswordValidator.state gets updated correctly.

Second though, when dijit.form.Form collects values from it's children, test_PasswordValidator.html expects it to collect values from the PasswordValidator's children, rather than PasswordValidator itself. So given a hierarchy like:

<form dojoType=dijit.form.Form>
    <div dojoType=dojox.form.PasswordValidator name="password">
         <input name="oldPw"/> ...
         <input name="newPw"/> ...

it expects form.get("value") to return {old: "foo", ...} rather than {password: {oldPw: "foo", ...}}. or {password: "bar"}. (The related question is what PasswordValidator returns for it's value, I think {oldPw: "foo", newPw: "bar"} makes sense but currently it's just "bar".)

comment:6 Changed 7 years ago by dylan

Milestone: tbd1.12

comment:7 Changed 6 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.