README.md in netzke-testing-1.0.0.0.pre vs README.md in netzke-testing-1.0.0.0
- old
+ new
@@ -27,20 +27,19 @@
Place the Mocha specs (written in Coffeescript) for your components inside `spec/features/javascripts` folder. An
example spec may look like this (in `spec/features/javascripts/user_grid.js.coffee`):
describe 'UserGrid', ->
it 'shows proper title', ->
- grid = Ext.ComponentQuery.query('panel[id="user_grid"]')[0]
- expect(grid.getHeader().title).to.eql 'Test component'
+ expect(grid().getHeader().title).to.eql 'Test component'
This spec can be run by appending the `spec` parameter to the url:
http://localhost:3000/netzke/components/UserGrid?spec=user_grid
Specs can be structured into directories. For example, let's say we have a namescope for admin components:
- class Admin::UserGrid < Netzke::Basepack::Grid
+ class Admin::UserGrid < Netzke::Grid::Base
end
It makes sense to put the corresponding specs in `spec/features/javascripts/admin/user_grid.js.coffee`. In this case,
the URL to run the Mocha specs will be:
@@ -109,13 +108,13 @@
require 'spec_helper'
feature GridWithDestructiveButton do
it 'allows instant removing of all records with a single button click', js: true do
10.times { FactoryGirl.create :user }
- User.count.should == 10
+ expect(User.count).to eql == 10
run_mocha_spec 'grid_with_destructive_button'
- User.count.should == 0
+ expect(User.count).to eql == 0
end
end
The `run_mocha_spec` here will run a Mocha spec from `spec/grid_with_destructive_button.js.coffee`.
@@ -148,24 +147,27 @@
## Asynchronous helpers
Asynchronous helpers like `wait` can either call the provided callback function, or (if none was provided) return a promise, so you can do:
- wait().
- .then ->
- doSomething()
- wait()
- .then
- doSomeMore()
+ it 'does something asynchronous', ->
+ wait().
+ .then ->
+ doSomething()
+ wait()
+ .then
+ doSomeMore()
+NOTE: we should not use the `done` parameter here, as promises are handled differently than callbacks by Mocha.
+
## Note on headless browser testing
No headless browsers like PhantomJS or WebKit were used for testing because our tests rely heavily on HTMLElement's `click` event, which is only properly implemented in "real" browsers like Firefox (which is what we use).
## Requirements
* Ruby >= 1.9.3
* Rails ~> 4.2.0
-* Ext JS = 5.1.0
+* Ext JS = 5.1.1
---
-Copyright (c) 2009-2015 [Good Bit Labs Limited](http://goodbitlabs.com/), released under the GPLv3 license
+Copyright (c) 2009-2016 [Good Bit Labs](http://goodbitlabs.com/), released under the same license as [Ext JS](https://www.sencha.com/legal/#Sencha_Ext_JS)