Fixed text module in zoom view, added browser tests.

This commit is contained in:
Martin Edenhofer 2013-08-19 15:15:49 +02:00
parent 8a92f300ff
commit 5a30476bc0
3 changed files with 69 additions and 5 deletions

View file

@ -211,7 +211,6 @@ class App.TicketCreate extends App.Controller
# update text module UI
callback = (user) =>
@textModule.reload(
data:
ticket:
customer: user
)

View file

@ -2,6 +2,7 @@ class App.TextModuleUI extends App.Controller
constructor: ->
super
@lastData = {}
customItemTemplate = "<div><span />&nbsp;<small /></div>"
elementFactory = (element, e) ->
template = $(customItemTemplate).find('span')
@ -23,7 +24,7 @@ class App.TextModuleUI extends App.Controller
reload: (data = false) =>
if data
@lastData = data
@lastData['data'] = data
@update()
update: =>
@ -35,10 +36,12 @@ class App.TextModuleUI extends App.Controller
contentNew = item.content.replace( /<%=\s{0,2}(.+?)\s{0,2}%>/g, ( all, key ) ->
key = key.replace( /@/g, 'ui.data.' )
varString = "#{key}" + ''
# console.log( "tag replacement env: ", ui.data)
try
# console.log( "tag replacement: " + key, varString )
key = eval (varString)
catch error
#console.log( "tag replacement: " + error )
# console.log( "tag replacement error: " + error )
key = ''
return key
)

View file

@ -361,6 +361,68 @@ class TextModuleTest < TestCase
},
],
},
{
:name => 'verify zoom',
:action => [
# create ticket
{
:where => :instance2,
:execute => 'create_ticket',
:group => 'Users',
:subject => 'some subject 123äöü',
:body => 'some body 123äöü',
},
# check ticket
{
:where => :instance2,
:execute => 'match',
:css => '.active div.article',
:value => 'some body 123äöü',
:match_result => true,
},
# check ticket zoom
{
:execute => 'wait',
:value => 4,
},
{
:where => :instance2,
:execute => 'set',
:css => '.active textarea[name=body]',
:value => '::' + random,
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'match',
:css => 'body',
:value => random,
:match_result => true,
},
{
:where => :instance2,
:execute => 'click',
:css => '.-sew-list-item.selected',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'match',
:css => '.active textarea[name=body]',
:value => 'some content' + random,
:match_result => true,
},
],
},
]
browser_double_test(tests)
end