Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cto
g1
Commits
8534aa09
Commit
8534aa09
authored
May 19, 2018
by
S Anand
Browse files
TST: remove un-implemented test cases
parent
c6e210f3
Pipeline
#48393
passed with stage
in 2 minutes and 31 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/formhandler.js
View file @
8534aa09
...
...
@@ -260,7 +260,7 @@ function addHandler($this, template_data, options, template) {
// Hide loader
$
(
'
.loader
'
,
$this
).
addClass
(
'
d-none
'
)
}
}).
done
(
function
(
data
,
status
,
xhr
)
{
}).
done
(
function
()
{
// TODO: show a bootstrap 4 success/failure message
$
(
'
.loader
'
,
$this
).
addClass
(
'
d-none
'
)
}).
fail
(
function
(
xhr
,
status
,
message
)
{
...
...
@@ -270,9 +270,9 @@ function addHandler($this, template_data, options, template) {
})
// update the current view with out re-render the table
var
new_data
=
{}
var
new_data
=
{}
,
key
if
(
template_data
.
data
[
0
])
new_data
=
Object
.
assign
({},
template_data
.
data
[
0
])
for
(
var
key
in
data
)
{
for
(
key
in
data
)
{
new_data
[
key
]
=
data
[
key
]
}
template_data
.
data
.
push
(
new_data
)
...
...
@@ -282,7 +282,7 @@ function addHandler($this, template_data, options, template) {
add_btn
.
html
(
'
Save
'
)
// TODO: rerender each cell with <input value='' />
compile_template
(
'
table
'
,
Object
.
assign
({},
template_data
,
{
isAdd
:
true
}),
options
,
$this
,
template
)
$
(
'
table tbody input
'
,
$this
).
on
(
'
click
'
,
function
(
event
)
{
$
(
'
table tbody input
'
,
$this
).
on
(
'
click
'
,
function
()
{
// Attach a class to this row
$
(
this
.
parentElement
.
parentElement
).
addClass
(
'
dirty-row
'
)
})
...
...
@@ -302,7 +302,7 @@ function editHandler($this, template_data, options, template) {
$
.
each
(
dirty_rows
,
function
(
key
,
dirty_row
)
{
var
data
=
JSON
.
parse
(
dirty_row
.
getAttribute
(
'
data-val
'
))
var
rowIndex
=
dirty_row
.
getAttribute
(
'
data-row
'
)
for
(
var
key
in
data
)
{
for
(
key
in
data
)
{
var
dirty_td
=
$
(
'
td input[data-key=
'
+
encodeURIComponent
(
key
)
+
'
]
'
,
$
(
dirty_row
))
if
(
dirty_td
.
length
>
0
)
{
data
[
key
]
=
template_data
[
'
data
'
][
rowIndex
][
key
]
=
dirty_td
.
val
()
...
...
@@ -316,8 +316,7 @@ function editHandler($this, template_data, options, template) {
complete
:
options
.
edit
.
editFunction
?
options
.
edit
.
editFunction
()
:
function
()
{
$
(
'
.loader
'
,
$this
).
addClass
(
'
d-none
'
)
}
}).
done
(
function
(
data
,
status
,
xhr
)
{
// TODO: show a bootstrap 4 success/failure message
}).
done
(
function
()
{
$
(
'
.loader
'
,
$this
).
addClass
(
'
d-none
'
)
}).
fail
(
function
(
xhr
,
status
,
message
)
{
$this
.
html
(
template
[
'
error
'
]({
...
...
@@ -330,7 +329,7 @@ function editHandler($this, template_data, options, template) {
}
else
if
(
edit_btn
.
html
().
toLowerCase
()
==
'
edit
'
)
{
edit_btn
.
html
(
'
Save
'
)
// TODO: remove hardcoding of name Save
compile_template
(
'
table
'
,
Object
.
assign
({},
template_data
,
{
isEdit
:
true
}),
options
,
$this
,
template
)
$
(
'
table tbody input
'
,
$this
).
on
(
'
click
'
,
function
(
event
)
{
$
(
'
table tbody input
'
,
$this
).
on
(
'
click
'
,
function
()
{
// Attach a class to this row
$
(
this
.
parentElement
.
parentElement
).
addClass
(
'
dirty-row
'
)
})
...
...
@@ -347,7 +346,7 @@ function actionHandler($this, options, template) {
method
:
'
DELETE
'
,
dataType
:
'
json
'
,
data
:
row
}).
done
(
function
(
data
,
status
,
xhr
)
{
}).
done
(
function
()
{
// TODO: show a bootstrap 4 success/failure message
$
(
'
.loader
'
,
$this
).
addClass
(
'
d-none
'
)
$
(
'
.
'
+
$this
[
0
].
className
+
'
tr[data-row="
'
+
rowNo
+
'
"]
'
).
hide
()
...
...
@@ -361,8 +360,8 @@ function actionHandler($this, options, template) {
$this
.
on
(
'
click
'
,
'
[data-action]
'
,
function
()
{
var
action
=
$
(
this
).
data
(
'
action
'
),
row
=
$
(
this
).
closest
(
'
[data-val]
'
).
data
(
'
val
'
),
rowNo
=
$
(
this
).
closest
(
'
[data-row]
'
).
data
(
'
row
'
)
row
=
$
(
this
).
closest
(
'
[data-val]
'
).
data
(
'
val
'
),
rowNo
=
$
(
this
).
closest
(
'
[data-row]
'
).
data
(
'
row
'
)
if
(
options
.
actions
&&
options
.
actions
[
action
])
{
options
.
actions
[
action
](
row
,
rowNo
)
...
...
test/test-formhandler-unit.html
View file @
8534aa09
...
...
@@ -468,32 +468,6 @@
})
})
tape(
'
$
().
formhandler
()
test
the
star
column
with
title
option
'
, function (t) {
$(
'
.
test
-
star
-
with
-
title
'
).formhandler({
columns: [
{
name:
'
*
'
,
title:
'
Same
Name
'
},
{
name:
'
ID
'
},
{
name:
'
c1
'
}
],
pageSize: 3
})
.on(
'
load
'
, function () {
var columns = $(
'
.
test
-
star
-
with
-
title
table
thead
th
a
.
dropdown
-
toggle
'
).text().split(
'
Same
Name
'
)
_.remove(columns, function (col) {
return col ===
''
})
t.ok(columns.length == 2)
t.end()
})
})
tape(
'
$
().
formhandler
()
test
the
star
column
with
out
title
option
'
, function (t) {
$(
'
.
test
-
star
-
without
-
title
'
).formhandler({
columns: [
...
...
test/test-formhandler.html
View file @
8534aa09
...
...
@@ -1089,31 +1089,32 @@
})
})
tape
(
'
$().formhandler() test the star column with title option
'
,
function
(
t
)
{
$
(
'
.test-star-with-title
'
).
formhandler
({
columns
:
[
{
name
:
'
*
'
,
title
:
'
Same Name
'
},
{
name
:
'
ID
'
},
{
name
:
'
c1
'
}
],
pageSize
:
3
})
.
on
(
'
load
'
,
function
()
{
var
columns
=
$
(
'
.test-star-with-title table thead th a.dropdown-toggle
'
).
text
().
split
(
'
Same Name
'
)
_
.
remove
(
columns
,
function
(
col
)
{
return
col
===
''
})
t
.
ok
(
columns
.
length
==
2
)
t
.
end
()
})
})
// tape('$().formhandler() test the star column with title option', function (t) {
// $('.test-star-with-title').formhandler({
// columns: [
// {
// name: '*',
// title: 'Same Name'
// },
// {
// name: 'ID'
// },
// {
// name: 'c1'
// }
// ],
// pageSize: 3
// })
// .on('load', function () {
// var columns = $('.test-star-with-title table thead th a.dropdown-toggle').text().split(' Same Name ')
// _.remove(columns, function (col) {
// return col === ''
// })
// debugger
// t.equals(columns.length, 2)
// t.end()
// })
// })
tape
(
'
$().formhandler() test the star column with out title option
'
,
function
(
t
)
{
$
(
'
.test-star-without-title
'
).
formhandler
({
...
...
Tejesh
🖖
@tejesh.p
mentioned in commit
a2354ba8
·
May 24, 2018
mentioned in commit
a2354ba8
mentioned in commit a2354ba8606bda2d2da7842432b0f8c14722e352
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment