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,9 +211,8 @@ class App.TicketCreate extends App.Controller
# update text module UI # update text module UI
callback = (user) => callback = (user) =>
@textModule.reload( @textModule.reload(
data: ticket:
ticket: customer: user
customer: user
) )
@userInfo( @userInfo(

View file

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