Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed SC.DateFieldView tests

  • Loading branch information...
commit a47eff4d4d9b253596f402aa982a0f1ef0c01407 1 parent b571ed0
@wagenet wagenet authored
Showing with 34 additions and 7 deletions.
  1. +34 −7 frameworks/desktop/tests/views/date_field/methods.js
View
41 frameworks/desktop/tests/views/date_field/methods.js
@@ -66,11 +66,38 @@ function() {
ok(view0.$().hasClass('disabled'), 'should have disabled class');
});
-test("isEnabled and isEditable mapping",
-function() {
- var obj = SC.DateFieldView.create();
- obj.set('isEnabled', false);
- equals(obj.get('isEditable'), false);
- obj.set('isEnabled', true);
- equals(obj.get('isEditable'), true);
+test("isEnabled=NO isEditable=NO should add disabled attribute", function() {
+ SC.RunLoop.begin();
+ view0.set('isEnabled', NO);
+ view0.set('isEditable', NO);
+ SC.RunLoop.end();
+ ok(view0.$input().attr('disabled'), 'should have disabled attribute');
+ ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
+});
+
+test("isEnabled=NO isEditable=YES should add disabled attribute", function() {
+ SC.RunLoop.begin();
+ view0.set('isEnabled', NO);
+ view0.set('isEditable', YES);
+ SC.RunLoop.end();
+ ok(view0.$input().attr('disabled'), 'should have disabled attribute');
+ ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
+});
+
+test("isEnabled=YES isEditable=NO should add readOnly attribute", function() {
+ SC.RunLoop.begin();
+ view0.set('isEnabled', YES);
+ view0.set('isEditable', NO);
+ SC.RunLoop.end();
+ ok(!view0.$input().attr('disabled'), 'should not have disabled attribute');
+ ok(view0.$input().attr('readOnly'), 'should have readOnly attribute');
+});
+
+test("isEnabled=YES isEditable=YES should not add disable or readOnly attribute", function() {
+ SC.RunLoop.begin();
+ view0.set('isEnabled', YES);
+ view0.set('isEditable', YES);
+ SC.RunLoop.end();
+ ok(!view0.$input().attr('disabled'), 'should not have disabled attribute');
+ ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
});
Please sign in to comment.
Something went wrong with that request. Please try again.