summaryrefslogtreecommitdiffstats
path: root/Sluift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2013-11-10 19:52:04 (GMT)
committerSwift Review <review@swift.im>2013-11-10 19:59:26 (GMT)
commitd674359cdefae70f3cc1fa6439c96c82b508b5e9 (patch)
treeca10fbff4a11871ab9a1be01729d57e514a3d831 /Sluift
parent0e29a6c750f30a089923b6f16d303b9640e0f589 (diff)
downloadswift-d674359cdefae70f3cc1fa6439c96c82b508b5e9.zip
swift-d674359cdefae70f3cc1fa6439c96c82b508b5e9.tar.bz2
Sluift: Use 'value' instead of 'values' for multi-value fields
Change-Id: Ie8d6bd4b732dd57cd4dc5ba63a9f6f6148348b2a
Diffstat (limited to 'Sluift')
-rw-r--r--Sluift/ElementConvertors/FormConvertor.cpp4
-rw-r--r--Sluift/Tests/FormTest.lua8
2 files changed, 6 insertions, 6 deletions
diff --git a/Sluift/ElementConvertors/FormConvertor.cpp b/Sluift/ElementConvertors/FormConvertor.cpp
index e44ca3e..9791bfa 100644
--- a/Sluift/ElementConvertors/FormConvertor.cpp
+++ b/Sluift/ElementConvertors/FormConvertor.cpp
@@ -92,7 +92,7 @@ namespace {
}
if (field->getType() == FormField::ListMultiType || field->getType() == FormField::JIDMultiType || field->getType() == FormField::TextMultiType) {
- luaField["values"] = Lua::valueRef(Lua::Array(field->getValues().begin(), field->getValues().end()));
+ luaField["value"] = Lua::valueRef(Lua::Array(field->getValues().begin(), field->getValues().end()));
}
else if (field->getType() == FormField::BooleanType) {
luaField["value"] = Lua::boolRef(field->getBoolValue());
@@ -179,7 +179,7 @@ namespace {
result->setBoolValue(*value);
}
else {
- lua_getfield(L, -1, "values");
+ lua_getfield(L, -1, "value");
if (lua_istable(L, -1)) {
for (lua_pushnil(L); lua_next(L, -2); ) {
if (lua_isstring(L, -1)) {
diff --git a/Sluift/Tests/FormTest.lua b/Sluift/Tests/FormTest.lua
index 7b6b4af..b2ec111 100644
--- a/Sluift/Tests/FormTest.lua
+++ b/Sluift/Tests/FormTest.lua
@@ -59,10 +59,10 @@ assert(public_field['required'] == true)
-- Test multi field
features_field = form['fields'][8]
assert(features_field['name'] == 'features')
-assert(type(features_field['values']) == 'table')
-assert(#features_field['values'] == 2)
-assert(features_field['values'][1] == 'news')
-assert(features_field['values'][2] == 'search')
+assert(type(features_field['value']) == 'table')
+assert(#features_field['value'] == 2)
+assert(features_field['value'][1] == 'news')
+assert(features_field['value'][2] == 'search')
-- Test shortcut index
assert(form['features']['name'] == 'features')