app/assets/javascripts/netzke/testing/helpers/expectations.js.coffee in netzke-testing-1.0.0.0.pre vs app/assets/javascripts/netzke/testing/helpers/expectations.js.coffee in netzke-testing-1.0.0.0
- old
+ new
@@ -1,19 +1,23 @@
-Ext.apply window,
+Ext.apply window, (->
+ throwIfNotFound = (cmp) ->
+ throw new Error(cmp + " not found") if Ext.isString(cmp)
+
expectToSee: (cmp) ->
- throw cmp + " not found" if Ext.isString(cmp)
+ throwIfNotFound(cmp)
expect(Ext.isObject(cmp) || Ext.isElement(cmp)).to.be.ok()
expectToNotSee: (el) ->
expect(Ext.isString(el)).to.be.ok()
expectDisabled: (cmp) ->
- throw cmp + " not found" if Ext.isString(cmp)
+ throwIfNotFound(cmp)
expect(cmp.isDisabled()).to.be(true)
expectEnabled: (cmp) ->
- throw cmp + " not found" if Ext.isString(cmp)
+ throwIfNotFound(cmp)
expect(cmp.isDisabled()).to.be(false)
expectInvisibleBodyOf: (cmp) ->
- throw cmp + " not found" if Ext.isString(cmp)
+ throwIfNotFound(cmp)
expect(cmp.body.isVisible()).to.be false
+ )()