1 /*jshint trailing:true, white:true, indent:2, strict:true, curly:true,
2 immed:true, eqeqeq:true, forin:true, latedef:true,
3 newcap:true, noarg:true, undef:true */
4 /*global XT:true, XM:true, XV:true, process:true, module:true, require:true,
5 describe:true, before:true, enyo:true, it:true, _:true, console:true */
10 var zombieAuth = require("../../lib/zombie_auth"),
11 common = require("../../lib/common"),
12 smoke = require("../../lib/smoke"),
13 _ = require("underscore"),
14 assert = require("chai").assert;
16 describe('Workspace Grid Boxes', function () {
17 this.timeout(45 * 1000);
19 before(function (done) {
20 // setup for the date widget
21 var appLoaded = function () {
25 zombieAuth.loadApp(appLoaded);
28 describe('Test Grid Boxes', function () {
29 it('Test Grid Box Functionality', function () {
31 _.each(XV, function (value, key) {
33 kinds = ['SalesOrderList', 'QuoteList', 'InvoiceList', 'ReturnList', 'ProjectList'];
34 // lists with grid boxes; TODO: find candidates automatically
35 if (_.contains(kinds, key)) {
37 describe('Create Workspace for XV.' + key, function () {
38 it('Create a Workspace', function () {
40 smoke.navigateToNewWorkspace(XT.app, list, function (workspaceContainer) {
41 var workspace = workspaceContainer.$.workspace;
42 _.each(workspace.$, function (component) {
43 if (XV.inheritsFrom(component, 'XV.GridBox')) {
45 describe('Test creating line items for ' + component, function () {
46 it('Create line items', function () {
47 var gridBox = component, gridRow,
48 startingRows = gridBox.liveModels().length;
51 gridRow = gridBox.$.editableGridRow;
52 // verify that there is an increase in rows
53 assert.equal(gridBox.liveModels().length, startingRows += 1);
55 // Add a new row using the enter key
56 gridRow.bubble("onkeyup", {keyCode: 13});
57 // verify again that a row has been added
58 assert.equal(gridBox.liveModels().length, startingRows += 1);
61 it('Check export', function () {
62 var getExportButton = function (obj) {
64 if (_.isObject(obj.$)) {
65 result = obj.$.exportButton ||
66 _.find(obj.$, getExportButton);
71 var gridBox = component,
72 exportButton = getExportButton(gridBox);
73 assert.ok(exportButton);
74 // TODO: need to populate before we can export
75 // assert.doesNotThrow(exportButton.doTap());
76 // TODO: find the generated file & check contents