Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
g1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
76
Issues
76
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cto
g1
Commits
4b7f0bcc
Commit
4b7f0bcc
authored
Mar 08, 2019
by
Tejesh
🖖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: undefined check in editable formhandler fails, fixes
#156
parent
6e6a643d
Pipeline
#79113
passed with stage
in 2 minutes and 21 seconds
Changes
5
Pipelines
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
866 additions
and
660 deletions
+866
-660
src/formhandler.template.html
src/formhandler.template.html
+2
-2
test/formhandler.csv
test/formhandler.csv
+197
-201
test/formhandler_csv.json
test/formhandler_csv.json
+589
-393
test/test-formhandler-editable.html
test/test-formhandler-editable.html
+74
-60
test/test-formhandler.html
test/test-formhandler.html
+4
-4
No files found.
src/formhandler.template.html
View file @
4b7f0bcc
...
@@ -185,7 +185,7 @@ Each template receives these variables:
...
@@ -185,7 +185,7 @@ Each template receives these variables:
>
>
<option
value=
""
disabled
selected
>
-- select --
</option>
<option
value=
""
disabled
selected
>
-- select --
</option>
<
%
_.each
(
isEditable.options
,
function
(
item
)
{
%
>
<
%
_.each
(
isEditable.options
,
function
(
item
)
{
%
>
<option
<%
-
val
&&
val =
==
item
?
'
selected
'
:
null
%
>
value="
<
%
-
item
%
>
">
<option
<%
-
val
!==
undefined
&&
val =
==
item
?
'
selected
'
:
null
%
>
value="
<
%
-
item
%
>
">
<
%
-
item
%
>
<
%
-
item
%
>
</option>
</option>
<
%
})
%
>
<
%
})
%
>
...
@@ -195,7 +195,7 @@ Each template receives these variables:
...
@@ -195,7 +195,7 @@ Each template receives these variables:
<
%
}
else
if
(isEditable.input =
=
'
radio
')
{
%
>
<
%
}
else
if
(isEditable.input =
=
'
radio
')
{
%
>
<
%
_.each
(
isEditable.options
,
function
(
item
)
{
%
>
<
%
_.each
(
isEditable.options
,
function
(
item
)
{
%
>
<input
type=
"radio"
<%
-
val
&&
val =
==
item
?
'
checked
'
:
null
%
>
value="
<
%
-
item
%
>
"
<input
type=
"radio"
<%
-
val
!==
undefined
&&
val =
==
item
?
'
checked
'
:
null
%
>
value="
<
%
-
item
%
>
"
<
%
for
(
key
in
isEditable.attrs
)
{
%
>
<
%
for
(
key
in
isEditable.attrs
)
{
%
>
<
%=
key
+
'="'
+
isEditable.attrs
[
key
]
+
'"'
%
>
<
%=
key
+
'="'
+
isEditable.attrs
[
key
]
+
'"'
%
>
<
%
}
%
>
<
%
}
%
>
...
...
test/formhandler.csv
View file @
4b7f0bcc
This diff is collapsed.
Click to expand it.
test/formhandler_csv.json
View file @
4b7f0bcc
This diff is collapsed.
Click to expand it.
test/test-formhandler-editable.html
View file @
4b7f0bcc
...
@@ -6,7 +6,8 @@
...
@@ -6,7 +6,8 @@
<link
rel=
"stylesheet"
href=
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"../node_modules/font-awesome/css/font-awesome.min.css"
>
<link
rel=
"stylesheet"
href=
"../node_modules/font-awesome/css/font-awesome.min.css"
>
<link
href=
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css"
rel=
"stylesheet"
/>
<link
href=
"https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css"
rel=
"stylesheet"
/>
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css"
/>
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css"
/>
<style>
<style>
.position-relative
{
.position-relative
{
position
:
relative
;
position
:
relative
;
...
@@ -113,15 +114,25 @@
...
@@ -113,15 +114,25 @@
}
}
}
}
},
},
{
name
:
'
Bool Col
'
,
editable
:
{
input
:
'
select
'
,
options
:
[
true
,
false
]
}
},
{
{
name
:
'
Actions
'
,
name
:
'
Actions
'
,
template
:
function
(
row
)
{
template
:
function
(
row
)
{
return
"
<td><button data-action='edit'><i class='fa fa-trash'></i></button></td>
"
return
"
<td><button data-action='edit'><i class='fa fa-trash'></i></button></td>
"
},
},
}
}
],
],
edit
:
{
edit
:
{
done
:
function
()
{
done
:
function
()
{
// test.ok(true, 'must call twice')
// test.ok(true, 'must call twice')
}
}
},
},
...
@@ -152,6 +163,8 @@
...
@@ -152,6 +163,8 @@
$
(
"
.edit-fh table > tbody > tr:nth-child(3) > td:nth-child(3) > input
"
).
val
(
'
-90
'
).
trigger
(
'
change
'
)
$
(
"
.edit-fh table > tbody > tr:nth-child(3) > td:nth-child(3) > input
"
).
val
(
'
-90
'
).
trigger
(
'
change
'
)
// save row
// save row
$
(
'
.edit button
'
).
click
()
$
(
'
.edit button
'
).
click
()
test
.
equals
(
$
(
'
div.formhandler tbody > tr:nth-child(2) > td:nth-child(7) > select
'
).
val
(),
"
false
"
)
test
.
equals
(
$
(
'
div.formhandler tbody > tr:nth-child(7) > td:nth-child(7) > select
'
).
val
(),
"
true
"
)
test
.
equals
(
$
(
'
.is-invalid
'
).
val
(),
'
300000
'
)
test
.
equals
(
$
(
'
.is-invalid
'
).
val
(),
'
300000
'
)
$
(
"
.edit-fh table > tbody > tr:nth-child(1) > td:nth-child(3) > input
"
).
val
(
'
35
'
).
trigger
(
'
change
'
)
$
(
"
.edit-fh table > tbody > tr:nth-child(1) > td:nth-child(3) > input
"
).
val
(
'
35
'
).
trigger
(
'
change
'
)
...
@@ -168,7 +181,8 @@
...
@@ -168,7 +181,8 @@
$
(
"
.edit-fh table > tbody > tr:nth-child(3) > td:nth-child(3) > input
"
).
val
(
'
28
'
).
trigger
(
'
change
'
)
$
(
"
.edit-fh table > tbody > tr:nth-child(3) > td:nth-child(3) > input
"
).
val
(
'
28
'
).
trigger
(
'
change
'
)
$
(
'
.edit button
'
).
click
()
$
(
'
.edit button
'
).
click
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
// COMMENTING NEXT TEST CASE: Gramex required
// COMMENTING NEXT TEST CASE: Gramex required
// test.notOk($('.add button').prop('disabled'))
// test.notOk($('.add button').prop('disabled'))
// test.equals($('.edit-btn').text(), 'Edit')
// test.equals($('.edit-btn').text(), 'Edit')
...
...
test/test-formhandler.html
View file @
4b7f0bcc
...
@@ -271,7 +271,7 @@
...
@@ -271,7 +271,7 @@
})
})
.
on
(
'
load
'
,
function
()
{
.
on
(
'
load
'
,
function
()
{
// no. of columns in meta data must be same as rendered columns
// no. of columns in meta data must be same as rendered columns
t
.
equal
(
$
(
'
.fh6 thead tr th
'
).
length
,
1
8
)
t
.
equal
(
$
(
'
.fh6 thead tr th
'
).
length
,
1
9
)
// there should not be a column with name 'Continent'
// there should not be a column with name 'Continent'
t
.
notOk
(
$
(
'
.fh6 thead tr
'
).
text
().
match
(
/Continent/
))
t
.
notOk
(
$
(
'
.fh6 thead tr
'
).
text
().
match
(
/Continent/
))
// there shoudl be a column with name 'CustomTitle'
// there shoudl be a column with name 'CustomTitle'
...
@@ -295,14 +295,14 @@
...
@@ -295,14 +295,14 @@
.
on
(
'
load
'
,
function
()
{
.
on
(
'
load
'
,
function
()
{
current_class_count
+=
1
current_class_count
+=
1
// no. of columns in meta data must be same as rendered columns
// no. of columns in meta data must be same as rendered columns
t
.
equal
(
$
(
'
.test_star_overrride thead tr th
'
).
length
,
1
8
*
current_class_count
)
t
.
equal
(
$
(
'
.test_star_overrride thead tr th
'
).
length
,
1
9
*
current_class_count
)
// there should not be a column with name 'Continent'
// there should not be a column with name 'Continent'
t
.
notOk
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/Continent/
))
t
.
notOk
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/Continent/
))
// there shoudl be a column with name 'CustomTitle'
// there shoudl be a column with name 'CustomTitle'
t
.
ok
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/CustomTitle/
))
t
.
ok
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/CustomTitle/
))
t
.
equal
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/CustomTitle/
).
length
,
1
)
t
.
equal
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
match
(
/CustomTitle/
).
length
,
1
)
// Rest of 16 columns must have title as 'SameName'
// Rest of 16 columns must have title as 'SameName'
t
.
equal
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
split
(
'
SameName
'
).
length
-
1
,
1
7
*
current_class_count
)
t
.
equal
(
$
(
'
.test_star_overrride thead tr
'
).
text
().
split
(
'
SameName
'
).
length
-
1
,
1
8
*
current_class_count
)
// column is hideable by default
// column is hideable by default
t
.
equal
(
$
(
'
.test_star_overrride [data-col="Continent"] div:nth-child(1) div a:last-of-type
'
).
text
().
trim
(),
"
Hide
"
.
repeat
(
current_class_count
))
t
.
equal
(
$
(
'
.test_star_overrride [data-col="Continent"] div:nth-child(1) div a:last-of-type
'
).
text
().
trim
(),
"
Hide
"
.
repeat
(
current_class_count
))
})
})
...
@@ -1075,7 +1075,7 @@
...
@@ -1075,7 +1075,7 @@
})
})
.
on
(
'
load
'
,
function
()
{
.
on
(
'
load
'
,
function
()
{
init_class_count
+=
1
init_class_count
+=
1
t
.
ok
(
$
(
'
.test-star-without-title table thead th a.dropdown-toggle
'
).
length
==
1
8
*
init_class_count
)
t
.
ok
(
$
(
'
.test-star-without-title table thead th a.dropdown-toggle
'
).
length
==
1
9
*
init_class_count
)
})
})
})
})
...
...
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