Commit 53e1f7dd authored by Tejesh's avatar Tejesh 🖖
Browse files

all fixed

parent 32e13edf
Pipeline #83650 passed with stage
in 2 minutes and 28 seconds
...@@ -97,18 +97,19 @@ export function formhandler(js_options) { ...@@ -97,18 +97,19 @@ export function formhandler(js_options) {
// If any column name is '*', show all columns // If any column name is '*', show all columns
var star_col_index = _.findIndex(options.columns, function (o) { return o['name'] === '*' }) var star_col_index = _.findIndex(options.columns, function (o) { return o['name'] === '*' })
if (star_col_index >= 0) { if (star_col_index >= 0) {
var resolved_star_cols = options.columns.map(function(each_col_options) { var resolved_star_cols = options.columns.map(function (each_col_options) {
if (each_col_options.name !== '*') return each_col_options if (each_col_options.name !== '*') return each_col_options
return meta.columns.map(function(col_opts) { return meta.columns
return Object.assign({}, options.columns[star_col_index], col_opts) .filter(function (col_opts) { return _.findIndex(options.columns, function (o) { return o['name'] === col_opts.name }) < 0 })
}) .map(function (col_opts) {
return Object.assign({}, options.columns[star_col_index], col_opts)
})
}).reduce(function (acc, curr) { }).reduce(function (acc, curr) {
if (!Array.isArray(curr)) return acc.concat([curr]) if (!Array.isArray(curr)) return acc.concat([curr])
return acc.concat(curr) return acc.concat(curr)
}, []) }, [])
options.columns = _.cloneDeep(resolved_star_cols) options.columns = _.cloneDeep(resolved_star_cols)
} }
// Render all components into respective targets // Render all components into respective targets
......
...@@ -51,9 +51,6 @@ ...@@ -51,9 +51,6 @@
tape('$() test link false renders just td tag, without a tag', function(t) { tape('$() test link false renders just td tag, without a tag', function(t) {
$('.no-link').formhandler({ $('.no-link').formhandler({
columns: [ columns: [
{
name: '*'
},
{ {
name: 'Continent', name: 'Continent',
link: '?ID=AND', link: '?ID=AND',
...@@ -73,6 +70,9 @@ ...@@ -73,6 +70,9 @@
'Diagonal' 'Diagonal'
] ]
} }
},
{
name: '*'
} }
], ],
pageSize: 3, pageSize: 3,
...@@ -81,8 +81,8 @@ ...@@ -81,8 +81,8 @@
edit: true edit: true
}) })
.on('load', function () { .on('load', function () {
t.equals($('div.no-link tr:nth-child(1) > td:nth-child(3)').text().trim(), "AND") t.equals($('div.no-link tr:nth-child(1) > td:nth-child(2)').text().trim(), "AND")
t.equals($('div.no-link tr:nth-child(2) > td:nth-child(3)').text().trim(), "ARE") t.equals($('div.no-link tr:nth-child(2) > td:nth-child(2)').text().trim(), "ARE")
t.ok($('div.no-link tr:nth-child(1) > td:nth-child(1) a').hasClass('urlfilter'), 'has class urlfilter') t.ok($('div.no-link tr:nth-child(1) > td:nth-child(1) a').hasClass('urlfilter'), 'has class urlfilter')
t.ok($('div.no-link tr:nth-child(1) > td:nth-child(1) a').attr('href'), '?ID=AND') t.ok($('div.no-link tr:nth-child(1) > td:nth-child(1) a').attr('href'), '?ID=AND')
...@@ -93,9 +93,6 @@ ...@@ -93,9 +93,6 @@
tape('$() test delete action for empty data case and test for edit and add button', function(t) { tape('$() test delete action for empty data case and test for edit and add button', function(t) {
$('.delete_btn').formhandler({ $('.delete_btn').formhandler({
columns: [ columns: [
{
name: '*'
},
{ {
name: 'ID', name: 'ID',
editable: false editable: false
...@@ -109,7 +106,10 @@ ...@@ -109,7 +106,10 @@
'Horizontal', 'Horizontal',
'Diagonal' 'Diagonal'
] ]
} },
},
{
name: '*'
}, },
{ {
name: 'DELETE Action', name: 'DELETE Action',
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
$('.add-btn').click() $('.add-btn').click()
t.ok($('.edit-btn').prop('disabled')) t.ok($('.edit-btn').prop('disabled'))
// stripes column is dropdown select HTML element and not input textbox // stripes column is dropdown select HTML element and not input textbox
t.equals($('div.delete_btn tr.new-row td:nth-child(21) select').length, 1) t.equals($('div.delete_btn tr.new-row td:nth-child(2) select').length, 1)
// all other columns must be input textbox and editable, overriding isEditable: false option also // all other columns must be input textbox and editable, overriding isEditable: false option also
t.equals($('div.delete_btn tr.new-row td:nth-child(1) input').length, 1) t.equals($('div.delete_btn tr.new-row td:nth-child(1) input').length, 1)
$('.add-btn').click() $('.add-btn').click()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment