app/assets/javascripts/netzke/testing/helpers/queries.js.coffee in netzke-testing-0.12.3 vs app/assets/javascripts/netzke/testing/helpers/queries.js.coffee in netzke-testing-1.0.0.0.pre
- old
+ new
@@ -8,15 +8,20 @@
Ext.ComponentQuery.query('tab[text="'+title+'"]')[0] || 'tab ' + title
panelWithContent: (text) ->
Ext.DomQuery.select("div.x-panel-body:contains(" + text + ")")[0] || 'panel with content ' + text
- button: (text) ->
- button = Ext.ComponentQuery.query("button{isVisible(true)}[text='"+text+"']")[0]
- button ||= Ext.ComponentQuery.query("button{isVisible(true)}[tooltip='"+text+"']")[0]
+ button: (text, params = {}) ->
+ context = params.within || Ext.ComponentQuery
+
+ button = context.query("button{isVisible(true)}[text='"+text+"']")[0]
+ button ||= context.query("button{isVisible(true)}[tooltip='"+text+"']")[0]
button || "button " + text
+ panel: (name) ->
+ Ext.getCmp(name)
+
tool: (type) ->
Ext.ComponentQuery.query("tool{isVisible(true)}[type='"+type+"']")[0] || 'tool ' + type
component: (id) ->
Ext.ComponentQuery.query("panel{isVisible(true)}[id='"+id+"']")[0] || 'component ' + id
@@ -30,30 +35,30 @@
throw "Panel not found" if !panel
panel.getHeader().getTitle().text
combobox: (name) ->
Ext.ComponentQuery.query("combo{isVisible(true)}[name='"+name+"']")[0] ||
- 'combobox ' + name
+ "combobox '#{name}'"
icon: (tooltip) ->
Ext.DomQuery.select('img[data-qtip="'+tooltip+'"]')[0] || 'icon ' + tooltip
textfield: (name) ->
Ext.ComponentQuery.query("textfield{isVisible(true)}[name='"+name+"']")[0] ||
- 'textfield ' + name
+ "textfield '#{name}'"
numberfield: (name) ->
Ext.ComponentQuery.query("numberfield{isVisible(true)}[name='"+name+"']")[0] ||
- 'numberfield ' + name
+ "numberfield '#{name}'"
datefield: (name) ->
Ext.ComponentQuery.query("datefield{isVisible(true)}[name='"+name+"']")[0] ||
- 'datefield ' + name
+ "datefield '#{name}'"
xdatetime: (name) ->
Ext.ComponentQuery.query("xdatetime{isVisible(true)}[name='"+name+"']")[0] ||
- 'xdatetime ' + name
+ "xdatetime '#{name}'"
textFieldWith: (text) ->
_componentLike "textfield", "value", text
comboboxWith: (text) ->
@@ -67,19 +72,19 @@
activeWindow: ->
Ext.WindowMgr.getActive()
dateTimeFieldWith: (value) ->
- res = 'xdatetime with value ' + value
+ res = "xdatetime with value '#{value}'"
Ext.each Ext.ComponentQuery.query('xdatetime'), (item) ->
if item.getValue().toString() == (new Date(value)).toString()
res = item
return
res
dateFieldWith: (value) ->
- res = 'datefield with value ' + value
+ res = "datefield with value '#{value}'"
Ext.each Ext.ComponentQuery.query('datefield'), (item) ->
if item.getValue().toString() == (new Date(value)).toString()
res = item
return
res
@@ -96,7 +101,8 @@
northRegion: ->
Ext.ComponentQuery.query("[region=north]")[0]
_componentLike:(type,attr,value)->
Ext.ComponentQuery.query(type+'['+attr+'='+value+']')[0] || type + " with " + attr + " '" + value + "'"
+
# alias
window.anywhere = window.somewhere