Improved App.Utils.replaceTags() - undefined and null values.
This commit is contained in:
parent
dc8d8b9786
commit
41f97d6f50
3 changed files with 35 additions and 2 deletions
|
@ -464,7 +464,7 @@ class App.Utils
|
|||
break
|
||||
if typeof dataRef is 'function'
|
||||
value = dataRef()
|
||||
else if dataRef.toString
|
||||
else if dataRef isnt undefined && dataRef isnt null && dataRef.toString
|
||||
value = dataRef.toString()
|
||||
else
|
||||
value = ''
|
||||
|
|
|
@ -898,6 +898,39 @@ test("check replace tags", function() {
|
|||
verify = App.Utils.replaceTags(message, data)
|
||||
equal(verify, result)
|
||||
|
||||
message = "<div>#{user.firstname} #{not.existing.test}</div>"
|
||||
result = '<div>Bob -</div>'
|
||||
data = {
|
||||
user: {
|
||||
firstname: 'Bob',
|
||||
},
|
||||
}
|
||||
verify = App.Utils.replaceTags(message, data)
|
||||
equal(verify, result)
|
||||
|
||||
message = "<div>#{user.firstname} #{not.existing.test}</div>"
|
||||
result = '<div>Bob -</div>'
|
||||
data = {
|
||||
user: {
|
||||
firstname: 'Bob',
|
||||
not: null,
|
||||
},
|
||||
}
|
||||
verify = App.Utils.replaceTags(message, data)
|
||||
equal(verify, result)
|
||||
|
||||
message = "<div>#{user.firstname} #{not.existing.test}</div>"
|
||||
result = '<div>Bob -</div>'
|
||||
data = {
|
||||
user: {
|
||||
firstname: 'Bob',
|
||||
not: {},
|
||||
},
|
||||
}
|
||||
verify = App.Utils.replaceTags(message, data)
|
||||
equal(verify, result)
|
||||
|
||||
|
||||
});
|
||||
|
||||
// check if last line is a empty line
|
||||
|
|
|
@ -140,7 +140,7 @@ class AgentTicketActionLevel0Test < TestCase
|
|||
watch_for(
|
||||
browser: browser2,
|
||||
css: '.active div[data-name=body]',
|
||||
value: 'some content ' + random,
|
||||
value: 'some content -' + random,
|
||||
)
|
||||
|
||||
ticket_customer_select(
|
||||
|
|
Loading…
Reference in a new issue