Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c4ef1f2

Browse files
author
Misko Hevery
committed
tests failing jstd to show cory
1 parent e0ad7df commit c4ef1f2

20 files changed

+171
-269
lines changed

jstd.log

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
2+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
3+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
4+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
5+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
6+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
7+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
8+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
9+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
10+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null
11+
java.lang.IllegalArgumentException: /com/google/jstestdriver/javascript/mysrc: resource is null

lib/jstestdriver/JsTestDriver.jar

6.33 KB
Binary file not shown.

server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
java -jar lib/jstestdriver/JsTestDriver.jar --port 9876
1+
java -jar lib/jstestdriver/JsTestDriver.jar --port 9876 --runnerMode DEBUG

src/Angular.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function extensionMap(angular, name) {
8383
}
8484

8585
function jqLiteWrap(element) {
86-
if (typeof element == 'string') {
86+
if (isString(element)) {
8787
var div = document.createElement('div');
8888
div.innerHTML = element;
8989
element = div.childNodes[0];
@@ -102,6 +102,12 @@ function lowercase(value){ return isString(value) ? value.toLowerCase() : value;
102102
function uppercase(value){ return isString(value) ? value.toUpperCase() : value; }
103103
function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; }
104104
function nodeName(element) { return (element[0] || element).nodeName; }
105+
106+
function isVisible(element) {
107+
var rect = element[0].getBoundingClientRect();
108+
return rect.width !=0 && rect.height !=0;
109+
}
110+
105111
function map(obj, iterator, context) {
106112
var results = [];
107113
foreach(obj, function(value, index, list) {

src/filters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var angularFilterGoogleChartApi;
2424

2525
foreach({
2626
'currency': function(amount){
27-
jQuery(this.$element).toggleClass('ng-format-negative', amount < 0);
27+
this.$element.toggleClass('ng-format-negative', amount < 0);
2828
return '$' + angularFilter['number'].apply(this, [amount, 2]);
2929
},
3030

@@ -60,7 +60,7 @@ foreach({
6060
},
6161

6262
'json': function(object) {
63-
jQuery(this.$element).addClass("ng-monospace");
63+
this.$element.addClass("ng-monospace");
6464
return toJson(object, true);
6565
},
6666

src/jqLite.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ JQLite.prototype = {
140140
this[0].className = trim((" " + this[0].className + " ").replace(/[\n\t]/g, " ").replace(" " + selector + " ", ""));
141141
},
142142

143+
toggleClass: function(selector, condition) {
144+
var self = this;
145+
(condition ? self.addClass : self.removeClass).call(self, selector);
146+
},
147+
143148
addClass: function( selector ) {
144149
if (!this.hasClass(selector)) {
145150
this[0].className = trim(this[0].className + ' ' + selector);

src/widgets.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ function valueAccessor(scope, element) {
2222
var validatorName = element.attr('ng-validate') || NOOP,
2323
validator = compileValidator(validatorName),
2424
required = element.attr('ng-required'),
25-
lastError,
25+
lastError, lastVisible,
2626
invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop};
2727
required = required || required === '';
2828
if (!validator) throw "Validator named '" + validatorName + "' not found.";
2929
function validate(value) {
30-
var error = required && !trim(value) ? "Required" : validator({state:scope, scope:{get:scope.$get, set:scope.$set}}, value);
31-
if (error !== lastError) {
30+
var error = required && !trim(value) ?
31+
"Required" :
32+
validator({state:scope, scope:{get:scope.$get, set:scope.$set}}, value),
33+
visible = isVisible(element);
34+
if (error !== lastError || visible !== lastVisible) {
3235
elementError(element, NG_VALIDATION_ERROR, error);
3336
lastError = error;
34-
if (error)
37+
lastVisible = visible;
38+
if (error && visible)
3539
invalidWidgets.markInvalid(element);
3640
else
3741
invalidWidgets.markValid(element);

test/BinderTest.js

Lines changed: 10 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -174,34 +174,6 @@ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){
174174
assertTrue(savedCalled);
175175
};
176176

177-
BinderTest.prototype.XtestParseEmptyAnchor = function(){
178-
var binder = this.compile("<div/>").binder;
179-
var location = binder.location;
180-
var anchor = binder.anchor;
181-
location.url = "a#x=1";
182-
binder.parseAnchor();
183-
assertEquals(1, binder.anchor.x);
184-
location.url = "a#";
185-
binder.parseAnchor();
186-
assertTrue("old values did not get removed", !binder.anchor.x);
187-
assertTrue("anchor gor replaced", anchor === binder.anchor);
188-
assertEquals('undefined', typeof (anchor[""]));
189-
};
190-
191-
BinderTest.prototype.XtestParseAnchor = function(){
192-
var binder = this.compile("<div/>").binder;
193-
var location = binder.location;
194-
location.url = "a#x=1";
195-
binder.parseAnchor();
196-
assertEquals(binder.anchor.x, "1");
197-
location.url = "a#a=b&c=%20&d";
198-
binder.parseAnchor();
199-
assertEquals(binder.anchor.a, 'b');
200-
assertEquals(binder.anchor.c, ' ');
201-
assertTrue(binder.anchor.d !== null);
202-
assertTrue(!binder.anchor.x);
203-
};
204-
205177
BinderTest.prototype.testRepeaterUpdateBindings = function(){
206178
var a = this.compile('<ul><LI ng-repeat="item in model.items" ng-bind="item.a"/></ul>');
207179
var form = a.node;
@@ -355,18 +327,6 @@ BinderTest.prototype.testNestedRepeater = function() {
355327
'</div></div>', sortedHtml(a.node));
356328
};
357329

358-
BinderTest.prototype.XtestRadioButtonGetsPrefixed = function () {
359-
var a = this.compile('<div><input ng-repeat="m in model" type="radio" name="m.a" value="on"/></div>');
360-
a.scope.$set('model', ['a1', 'a2']);
361-
a.scope.$eval();
362-
363-
assertEquals('</div>' +
364-
'<#comment></#comment>'+
365-
'<input name="0:m.a" ng-repeat-index="0" type="radio" value="on"></input>'+
366-
'<input name="1:m.a" ng-repeat-index="1" type="radio" value="on"></input></div>',
367-
sortedHtml(a.node));
368-
};
369-
370330
BinderTest.prototype.testHideBindingExpression = function() {
371331
var a = this.compile('<div ng-hide="hidden == 3"/>');
372332

@@ -525,31 +485,6 @@ BinderTest.prototype.testShouldTemplateBindPreElements = function () {
525485
assertEquals('<pre ng-bind-template="Hello {{name}}!">Hello World!</pre>', sortedHtml(c.node));
526486
};
527487

528-
BinderTest.prototype.XtestDissableAutoSubmit = function() {
529-
var c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:true});
530-
assertEquals(
531-
'<input ng-action="$save()" ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}" type="submit" value="S"></input>',
532-
sortedHtml(c.node));
533-
534-
c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:false});
535-
assertEquals(
536-
'<input type="submit" value="S"></input>',
537-
sortedHtml(c.node));
538-
};
539-
540-
BinderTest.prototype.XtestSettingAnchorToNullOrUndefinedRemovesTheAnchorFromURL = function() {
541-
var c = this.compile('');
542-
c.binder.location.set("http://server/#a=1&b=2");
543-
c.binder.parseAnchor();
544-
assertEquals('1', c.binder.anchor.a);
545-
assertEquals('2', c.binder.anchor.b);
546-
547-
c.binder.anchor.a = null;
548-
c.binder.anchor.b = null;
549-
c.binder.updateAnchor();
550-
assertEquals('http://server/#', c.binder.location.get());
551-
};
552-
553488
BinderTest.prototype.testFillInOptionValueWhenMissing = function() {
554489
var c = this.compile(
555490
'<select><option selected="true">{{a}}</option><option value="">{{b}}</option><option>C</option></select>');
@@ -570,9 +505,11 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() {
570505
expect(optionC.text()).toEqual('C');
571506
};
572507

573-
BinderTest.prototype.XtestValidateForm = function() {
574-
var c = this.compile('<input name="name" ng-required>' +
575-
'<div ng-repeat="item in items"><input name="item.name" ng-required/></div>');
508+
BinderTest.prototype.testValidateForm = function() {
509+
var doc = jqLite(document.body);
510+
doc.append('<div><input name="name" ng-required>' +
511+
'<div ng-repeat="item in items"><input name="item.name" ng-required/></div></div>');
512+
var c = this.compile(doc);
576513
var items = [{}, {}];
577514
c.scope.$set("items", items);
578515
c.scope.$eval();
@@ -599,8 +536,9 @@ BinderTest.prototype.XtestValidateForm = function() {
599536
assertEquals(0, c.scope.$get("$invalidWidgets.length"));
600537
};
601538

602-
BinderTest.prototype.XtestValidateOnlyVisibleItems = function(){
603-
var c = this.compile('<input name="name" ng-required><input ng-show="show" name="name" ng-required>');
539+
BinderTest.prototype.testValidateOnlyVisibleItems = function(){
540+
var c = this.compile('<div><input name="name" ng-required><input ng-show="show" name="name" ng-required></div>');
541+
jqLite(document.body).append(c.node);
604542
c.scope.$set("show", true);
605543
c.scope.$eval();
606544
assertEquals(2, c.scope.$get("$invalidWidgets.length"));
@@ -629,62 +567,6 @@ BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() {
629567
assertChild(5, false);
630568
};
631569

632-
BinderTest.prototype.XtestItShouldCallListenersWhenAnchorChanges = function() {
633-
var log = "";
634-
var c = this.compile('<div ng-watch="$anchor.counter:count = count+1">');
635-
c.scope.$set("count", 0);
636-
c.scope.$watch("$anchor.counter", function(newValue, oldValue){
637-
log += oldValue + "->" + newValue + ";";
638-
});
639-
assertEquals(0, c.scope.$get("count"));
640-
c.binder.location.url = "#counter=1";
641-
c.binder.onUrlChange();
642-
assertEquals(1, c.scope.$get("count"));
643-
644-
c.binder.location.url = "#counter=1";
645-
c.binder.onUrlChange();
646-
assertEquals(1, c.scope.$get("count"));
647-
648-
c.binder.location.url = "#counter=2";
649-
c.binder.onUrlChange();
650-
assertEquals(2, c.scope.$get("count"));
651-
652-
c.binder.location.url = "#counter=2";
653-
c.binder.onUrlChange();
654-
assertEquals(2, c.scope.$get("count"));
655-
656-
c.binder.location.url = "#";
657-
c.binder.onUrlChange();
658-
assertEquals("undefined->1;1->2;2->undefined;", log);
659-
assertEquals(3, c.scope.$get("count"));
660-
};
661-
662-
BinderTest.prototype.XtestParseQueryString = function(){
663-
var binder = new Binder();
664-
assertJsonEquals({"a":"1"}, binder.parseQueryString("a=1"));
665-
assertJsonEquals({"a":"1", "b":"two"}, binder.parseQueryString("a=1&b=two"));
666-
assertJsonEquals({}, binder.parseQueryString(""));
667-
668-
assertJsonEquals({"a":"1", "b":""}, binder.parseQueryString("a=1&b="));
669-
assertJsonEquals({"a":"1", "b":""}, binder.parseQueryString("a=1&b"));
670-
assertJsonEquals({"a":"1", "b":" 2 "}, binder.parseQueryString("a=1&b=%202%20"));
671-
assertJsonEquals({"a a":"1", "b":"2"}, binder.parseQueryString("a%20a=1&b=2"));
672-
673-
};
674-
675-
BinderTest.prototype.XtestSetBinderAnchorTriggersListeners = function(){
676-
expectAsserts(2);
677-
var doc = this.compile("<div/>");
678-
679-
doc.scope.$watch("$anchor.name", function(newVal, oldVal) {
680-
assertEquals("new", newVal);
681-
assertEquals(undefined, oldVal);
682-
});
683-
684-
doc.$anchor.name = "new";
685-
doc.binder.onUrlChange("http://base#name=new");
686-
};
687-
688570
BinderTest.prototype.testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = function(){
689571
var c = this.compile('<div>' +
690572
'<input type="button" ng-click="greeting=\'ABC\'"/>' +
@@ -768,9 +650,9 @@ BinderTest.prototype.testItBindHiddenInputFields = function(){
768650
assertEquals("abc", x.scope.$get("myName"));
769651
};
770652

771-
BinderTest.prototype.xtestItShouldRenderMultiRootHtmlInBinding = function() {
653+
BinderTest.prototype.XtestItShouldRenderMultiRootHtmlInBinding = function() {
772654
var x = this.compile('<div>before {{a|html}}after</div>');
773-
x.scope.$set("a", "a<b>c</b>d");
655+
x.scope.a = "a<b>c</b>d";
774656
x.scope.$eval();
775657
assertEquals(
776658
'<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>',
@@ -790,20 +672,3 @@ BinderTest.prototype.testItShouldUseFormaterForText = function() {
790672
assertEquals('1, 2, 3', input[0].value);
791673
};
792674

793-
BinderTest.prototype.XtestWriteAnchor = function(){
794-
var binder = this.compile("<div/>").binder;
795-
binder.location.set('a');
796-
binder.anchor.a = 'b';
797-
binder.anchor.c = ' ';
798-
binder.anchor.d = true;
799-
binder.updateAnchor();
800-
assertEquals(binder.location.get(), "a#a=b&c=%20&d");
801-
};
802-
803-
BinderTest.prototype.XtestWriteAnchorAsPartOfTheUpdateView = function(){
804-
var binder = this.compile("<div/>").binder;
805-
binder.location.set('a');
806-
binder.anchor.a = 'b';
807-
binder.updateView();
808-
assertEquals(binder.location.get(), "a#a=b");
809-
};

test/ConsoleTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ ConsoleTest.prototype.XtestConsoleWrite = function(){
77
assertEquals(jqLite(consoleNode).text(), 'Hello world');
88
assertEquals(jqLite(consoleNode.childNodes[0])[0].className, 'error');
99
consoleLog("error",["Bye"]);
10-
assertEquals($(consoleNode).text(), 'Hello worldBye');
10+
assertEquals(jqLite(consoleNode).text(), 'Hello worldBye');
1111
consoleNode = null;
1212
};

0 commit comments

Comments
 (0)