Permalink
Browse files

fixed field data in Object bug

  • Loading branch information...
1 parent 18b16a5 commit 80749415f2d04495b785c8c43b97ed91e8eaaddc @jessetane committed Nov 5, 2012
Showing with 43 additions and 4 deletions.
  1. +0 −1 .gitignore
  2. 0 example/{osx → say}
  3. +1 −1 lib/cui.js
  4. +2 −2 package.json
  5. +40 −0 test/fieldsArrayVsObject.js
View
@@ -1,4 +1,3 @@
.DS_Store
node_modules
notes
-.nide
File renamed without changes.
View
@@ -148,7 +148,7 @@ function getFieldInputs () {
ui.getFieldInputs(fields, function (inputs) {
if (hash) {
for (var key in inputs) hash[key] = inputs[key];
- results = results.push(hash);
+ results.push(hash);
} else {
results = results.concat(inputs);
}
View
@@ -1,11 +1,11 @@
{
"name": "cui",
"description": "GUIs for the command line.",
- "version": "0.0.2",
+ "version": "0.0.3",
"main": "lib/cui.js",
"author": "Jesse Tane <jesse.tane@gmail.com>",
"dependencies": {
- "coffee-script" : "1.3.3"
+ "coffee-script" : "1.4.0"
},
"bin": {
"cui": "lib/cui.js"
@@ -0,0 +1,40 @@
+#!/usr/bin/env node
+
+/*
+ * fieldsArrayVsObject.js
+ *
+ */
+
+
+var cui = require("../lib/cui");
+var assert = require("assert");
+
+cui.view({
+ title: "This tests fields in an Array",
+ type: "fields",
+ data: [
+ "One: ",
+ "Two: ",
+ "Three: "
+ ],
+ action: function (cb) {
+ console.log("Answers: \"" + cui.results + "\"");
+ assert.ok(cui.results.length === 3);
+ cb();
+ }
+});
+
+cui.view({
+ title: "This tests fields in an Object",
+ type: "fields",
+ data: {
+ one: "One: ",
+ two: "Two: ",
+ three: "Three: "
+ },
+ action: function (cb) {
+ console.log("Answers: \"" + cui.results + "\"");
+ assert.ok(cui.results.length === 4 && cui.results[3].toString() === {}.toString());
+ cb();
+ }
+});

0 comments on commit 8074941

Please sign in to comment.