From 2987f7f705baffad8081fc4a3a95eab79b0d9695 Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Thu, 22 Jul 2010 15:32:57 -0700
Subject: fix howers which were accidently broken
---
example/buzz/buzz.css | 45 +++++++++++++++++++++++++++++++++++++++++++++
example/buzz/buzz.html | 36 ++++++++++++++++++++++--------------
example/buzz/buzz.js | 27 +++++++++++++++++++++++++++
src/Browser.js | 1 +
src/directives.js | 2 --
test/BinderTest.js | 9 +--------
test/directivesSpec.js | 5 -----
7 files changed, 96 insertions(+), 29 deletions(-)
diff --git a/example/buzz/buzz.css b/example/buzz/buzz.css
index e69de29b..e77c3bac 100644
--- a/example/buzz/buzz.css
+++ b/example/buzz/buzz.css
@@ -0,0 +1,45 @@
+body {
+ background: -webkit-gradient(linear, left top, left 400, from(#1C4070), to(#fff));
+ background-repeat: no-repeat;
+ margin: 0px;
+}
+
+.bar {
+ border-top: 1px solid white;
+ border-bottom: 1px solid black;
+ text-align: right;
+ background: -webkit-gradient(linear, left top, left bottom, from(#CCC), to(#888));
+ -webkit-background-origin: padding; -webkit-background-clip: content;
+}
+.bar button {
+ margin: 5px;
+}
+
+.bar span {
+ float: left;
+ font-family: monospace;
+ font-size: 1.5em;
+ color: black;
+}
+
+ul.buzz {
+ list-style: none;
+ padding: 5px;
+ margin: 0;
+}
+
+ul.buzz > li {
+ border: 1px solid yellow;
+ margin: 5px;
+ padding: 0;
+}
+
+ul.buzz > li > h1 {
+ border: 1px solid yellow;
+ margin: 0;
+}
+
+ul.buzz > li > div {
+ border: 1px solid yellow;
+ margin: 0;
+}
diff --git a/example/buzz/buzz.html b/example/buzz/buzz.html
index ee2b2bb9..f1916f54 100644
--- a/example/buzz/buzz.html
+++ b/example/buzz/buzz.html
@@ -2,28 +2,36 @@
+
-
+
-
+ <angular/> Buzz
+
-
+
diff --git a/example/buzz/buzz.js b/example/buzz/buzz.js
index 871982d7..40813d16 100644
--- a/example/buzz/buzz.js
+++ b/example/buzz/buzz.js
@@ -15,5 +15,32 @@ BuzzController.prototype = {
userChange: function(){
this.userId = this.$location.hashPath;
this.activities = this.Activity.get({userId:this.userId});
+ },
+
+ expandReplies: function(activity) {
+ var self = this;
+ if (activity.replies) {
+ activity.replies.show = !activity.replies.show;
+ } else {
+ activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}, function(){
+ activity.replies.show = true;
+ });
+ }
}
};
+
+angular.widget('my:expand', function(element){
+ element.css('display', 'block');
+ this.descend(true);
+ return function(element) {
+ element.hide();
+ var watch = element.attr('expand');
+ this.$watch(watch, function(value){
+ if (value) {
+ element.delay(0).slideDown('slow');
+ } else {
+ element.slideUp('slow');
+ }
+ });
+ };
+});
diff --git a/src/Browser.js b/src/Browser.js
index 3299540c..2777dcda 100644
--- a/src/Browser.js
+++ b/src/Browser.js
@@ -22,6 +22,7 @@ function Browser(location, document, head) {
this.location = location;
this.document = document;
+ this.body = jqLite(document[0].body);
this.head = head;
this.idCounter = 0;
}
diff --git a/src/directives.js b/src/directives.js
index 04831131..3e0aeffb 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -161,8 +161,6 @@ angularWidget("@ng:repeat", function(expression, element){
valueIdent = match[3] || match[1];
keyIdent = match[2];
- if (isUndefined(this.$eval(rhs))) this.$set(rhs, []);
-
var children = [], currentScope = this;
this.$onEval(function(){
var index = 0, childCount = children.length, childScope, lastElement = reference,
diff --git a/test/BinderTest.js b/test/BinderTest.js
index 44f918e4..b90d1789 100644
--- a/test/BinderTest.js
+++ b/test/BinderTest.js
@@ -27,7 +27,7 @@ BinderTest.prototype.testChangingTextfieldUpdatesModel = function(){
state.scope.$eval();
assertEquals('abc', state.scope.model.price);
};
-
+
BinderTest.prototype.testChangingTextareaUpdatesModel = function(){
var c = this.compile('');
c.scope.$eval();
@@ -472,13 +472,6 @@ BinderTest.prototype.testRepeaterShouldBindInputsDefaults = function () {
assertEquals("misko", c.scope.$eval('items[1].name'));
};
-BinderTest.prototype.testRepeaterShouldCreateArray = function () {
- var c = this.compile('');
- c.scope.$eval();
-
- assertEquals(0, c.scope.$get('items').length);
-};
-
BinderTest.prototype.testShouldTemplateBindPreElements = function () {
var c = this.compile('
Hello {{name}}!');
c.scope.$set("name", "World");
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index dffc8906..8a7da41d 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -140,11 +140,6 @@ describe("directives", function(){
expect(element.text()).toEqual('misko:swe;shyam:set;');
});
- it('should set ng:repeat to [] if undefinde', function(){
- var scope = compile('');
- expect(scope.items).toEqual([]);
- });
-
it('should error on wrong parsing of ng:repeat', function(){
var scope = compile('');
var log = "";
--
cgit v1.2.3