Permalink
Browse files

Update specs to validate empty inputs.

  • Loading branch information...
1 parent a577f3a commit 2df5033ca09d033d883d9df7920a0e93cd5df016 @stas stas committed Apr 25, 2012
Showing with 15 additions and 4 deletions.
  1. +15 −4 dependency-examples/emberjs_require/js/app/specs/controllers/todos.js
@@ -13,25 +13,36 @@ describe( 'controllers/todos', function() {
).to.equal( controller.inputView.get( 'placeholder' ) );
});
+ it( 'should not allow empty values on edits', function() {
+ var editorField = controller.todoEditor.create({ value: title });
+ editorField.whenDone();
+ expect( editorField.get( 'value' ) ).to.equal( title );
+ });
+
it( 'should create new entry on newline', function() {
controller.inputView.set( 'value', title );
controller.inputView.insertNewline();
expect( controller.get( 'lastObject' ).title ).to.equal( title );
controller.removeObject( controller.get( 'lastObject' ) );
});
+ it( 'should not allow empty values on entry changes', function() {
+ controller.createNew( title );
+ var entry = controller.get( 'lastObject' );
+ entry.set( 'title', ' ' );
+ expect( entry.title ).to.equal( title );
+ });
+
it( 'should reflect the same number of items as in store', function() {
- controller.inputView.set( 'value', title );
- controller.inputView.insertNewline();
+ controller.createNew( 'value', title );
var visibles = controller.todosView.
get( 'childViews' )[ 0 ].get( 'childViews' ).length;
expect( controller.get( 'content' ).length ).to.equal( visibles );
controller.removeObject( controller.get( 'lastObject' ) );
});
it( 'should allow removing entries', function( done ) {
- controller.inputView.set( 'value', title );
- controller.inputView.insertNewline();
+ controller.createNew( 'value', title );
setTimeout( function(){
controller.allDoneCheckbox.set( 'value', true );
}, 100 );

0 comments on commit 2df5033

Please sign in to comment.