6. QuickBooks now has ~100K lines of
JavaScript
● Need to plan up-front to develop a code base
of this size.
● We chose Dojo as a turnkey/complete
solution. Countless alternatives available.
12. Two-Way Binding
<div data-qbo-bind="visible: showDate">
<div>${nls.date}</div>
<input class="dateInput" type="text"
data-qbo-bind="value: date"
data-dojo-type="qbo/widgets/DateTextBox”/>
</div>
visible: showDate
Hide/Show bound to this.model properties
${nls.date}
Externalization of strings
value: date
2-way value binding
13. MVC + Services
● Many MVC frameworks to choose from
● AMD to load HTML client-side templates
● Isolate XHR calls from your model using a services interface
define([
...
"dojo/text!./templates/View.html",
...
], function(..., View, ... ) {
constructor: function(args) {
// Services
this.txnService = args.TxnService || new TxnService( );
14. Write your first unit test on your first day
Leverage intern for tests, integrated with Sauce Labs
beforeEach: function () { model = new Model(new TxnMockService()); },
afterEach: function () { model = null; },
"Test Is Connected Bank Account (Positive)": function () {
var failureHint = "Should return true if fiName is present.",
res = model.isConnectedBankAccount({
fiName: "Test"
});
assert.isTrue(res, failureHint);
}
Services isolation will allow you to mock XHR calls