emberjs / ember.js Goto Github PK
View Code? Open in Web Editor NEWEmber.js - A JavaScript framework for creating ambitious web applications
Home Page: https://emberjs.com
License: MIT License
Ember.js - A JavaScript framework for creating ambitious web applications
Home Page: https://emberjs.com
License: MIT License
Steps to reproduce:Open the todos sample.Add a to-do and mark it complete.Press Tab until the edit box receives focus, then press Tab one more time. The focus is now on the "Clear Completed Todos".Press Space.Excepted behavior: The button is activated and the list is cleared.Observed behavior: Nothing.Tested in Firefox 5 and Chrome 13 beta.
inside a templateview with SPAN tag I have another SPAN with a binded class attribute, which is supposed to change on custom actions. Now the problem is that the binded className gets applied to the outer SPAN (of the view itself) and not the inner SPAN where the bind attribute is defined.
I have a complete example below, which illustrates the behaviour (based on SC 2.0 a3 from starterkit)
I will try to add failing test for this, but for now here is error reproduced on jsfiddle: http://jsfiddle.net/b4RMr/10/
Both boxes have classes from bindings repeated twice. When you change classNameBinding to "parentView.foo" instead of just "foo" it starts to work correctly.
Hi,
I'm getting this error after switching from some older version of SC2 to the latest version on master (actually it's https://github.com/sproutcore/sproutcore20/tree/e16466cb58b87a05e45b28f572663a489619f905).
Here's a test case: http://jsfiddle.net/szimek/LbEPG/
Everything is rendered "correctly", but in the console you'll notice that it throws You can't insert an element into the DOM that has already been inserted
error.
Funny thing is that if you change timeout to 0 in App.Controllers.application.connect
function or remove class name bindings from App.Views.Wrapper
view then it works fine and doesn't throw any error...
There's also another issue (I'm not sure if it's related) - App.Views.Wrapper
binded class is displayed twice - it's class="sc-views John John"
. Not sure why...
The SC.run documentation says that SC.run passes any extra arguments on to the method. But SC.run doesn't actually do that. Extra arguments to SC.run are ignored.
The following program correctly triggers the helperMissing handler, but instead of a nice exception we get a TypeError because options.data
is undefined.
<html>
<body>
<script type="text/html">
{{#if A.value}}
{{no_such_helper foo}}
{{/if}}
</script>
<script type="text/javascript" src="/javascripts/jquery.js"></script>
<script type="text/javascript" src="/javascripts/sproutcore.js"></script>
<script type="text/javascript">
A = SC.Application.create();
A.set('value', true);
</script>
</body>
</html>
In the guides.sproutcore20.com, the Handlebars section uses type="text/x-handlebars" , it need to be "text/html".
Is there a repository to submit fixes on that guide ?
Hey,
there's something messed up in the current master branch (f87b064) with rendering integer values in templates.
Here's a working example when template is directly in a view: http://jsfiddle.net/szimek/9EE5M/
Here's almost the same example, but the template is fetched from a script in head element: http://jsfiddle.net/szimek/9EE5M/1/ and it raises Uncaught TypeError: Object 5 has no method 'string'
error
The same thing works fine with beta 1: http://jsfiddle.net/szimek/9EE5M/2/
Looks like it's a bug in SC._RenderBuffer#string
method. In https://github.com/sproutcore/sproutcore20/blob/master/packages/sproutcore-views/lib/system/render_buffer.js#L348 it tries to call buffer.string()
if buffer is not a string. In this case buffer
is 5
and 5
doesn't have a string
method.
The instructions for running the unit tests appears wrong. At least for me running gem install spade
does not give me a spadepkg command. I'm getting the 0.1.1.1 version of the spade gem. Which appears different than what is here:
https://github.com/strobecorp/spade
I found spade-packager which does give me a spadepkg command. So after doing
gem install spade-packager
gem install spade-core
Then I could run
spadepkg install sproutcore-preprocessor
But that then returns:
Can't find package sproutcore-preprocessor >= 0 available for install
So in summary there are 2 issues here:
gem install spade
installing spadepkgIf a string attribute on an SC.Record is set to null, it is returned as null when accessed through the base store, but returned as the string "[object Object]" when accessed through a nested store. The following program demonstrates the problem:
<html>
<body>
<script type="text/javascript" src="/javascripts/jquery.js"></script>
<script type="text/javascript" src="/javascripts/sproutcore.js"></script>
<script type="text/javascript" src="/javascripts/sproutcore-datastore.js"></script>
<script type="text/html">
<h1>From original store</h1>
name: {{A.rec.name}}<br/>
nameIsNull: {{A.rec.nameIsNull}}
<h1>From nested store</h1>
name: {{A.nrec.name}}<br/>
nameIsNull: {{A.nrec.nameIsNull}}
</script>
<script type="text/javascript">
A = SC.Application.create()
A.Rec = SC.Record.extend({
name: SC.Record.attr(String),
nameIsNull: function(){ return this.get('name') === null }.property('name')
})
A.store = SC.Store.create();
A.store.loadRecords(A.Rec, [{name: null}]);
A.rec = A.store.find(A.Rec).get('firstObject');
A.nrec = A.store.chain().find(A.rec)
</script>
</body>
</html>
You can view this in action here: http://b.sweetbytes.net/javascripts/test.html
Currently @each
property is defined in SC.Array
mixin. It would be great if it worked with e.g. SC.Set
as well.
I'm not sure if it's a bug or not, but it looks like parent views are removed before child views. Here's an example: http://jsfiddle.net/szimek/jGdgw
In the child view I have a binding which calls parentView.name
, but when the parent view is destroyed, this binding function is called and becasue parentView === null
it throws an error.
Should I explicitly check for parentView
or this.get('state') === 'inDOM'
or is it a bug?
Hey there,
I found a little issue while writing a custom render
function.
Steps to replicate:
var b = new SC.RenderBuffer('div'); b.push('a'); b.push('b'); b.string()
Result:
"<div >a,b</div>"
Expected:
"<div >ab</div>"
Reason:
Array.join
uses a comma as default delimiter when no arguments are passed:
['a', 'b'].join() => 'a,b'
In IE8, sproutcore 2.0 beta 1 produces the following error:
Line: 1615
Char: 8
Error: Expected constant
On platforms that can't use the native Object.defineProperty (like certain Android, see issue #85) the SC.META_KEY property becomes enumerable and the following statement causes jQuery to enter infinite recursion:
jQuery.extend(true, {}, {a:[]})
(because it's trying to deep copy [][SC.META_KEY].source[SC.META_KEY].source)
)
So I assumed that I need to set ENV.EXTEND_PROTOTYPES=false to make sproutcore leave the Array prototype alone. However, there is code within sproutcore itself that breaks when EXTEND_PROTOTYPES is disabled (calls to Function.property, Function.cacheable, Array.insertAt, etc).
It wouldn't be hard to fix these issues, but I want to ask if this is a change that's likely to be accepted before I take the time to do it. Is Sproutcore committed to working under EXTEND_PROTOTYPES==false?
If so I would also recommend changing the overall unit test configuration so it's immediately apparent if somebody tries to use these methods within Sproutcore.
I ran into a bug where a library I was using in my SC app was delegating some of its events to window
, but sproutcore is stopping propagation on those events before they ever get there. (This could potentially be even worse if someone declares app.rootElement)
Here's a failing test which demonstrates this: https://github.com/dmarcotte/sproutcore20/commit/c2c4db2a4556ef2af10b975fbba20e5f96d55e49#diff-1
I was playing with a couple of ways to fix this:
The docs on http://docs.sproutcore20.com are outdated. Maybe someone with access to this site can upload the current beta1 docs to this location.
EmptyViews are giving up after they are rendered a few times.
Here's a fiddle which demonstrates: http://jsfiddle.net/GJWEh/. After emptying out the collection's content a few times, it just starts rending empty, instead of the EmptyView.
If you create a new instance of an object without passing a hash, duplicate guids will be returned for that object.
For example:
var foo = SC.Object.create();
var bar = SC.Object.create();
foo === bar; // false
SC.guidFor(foo) === SC.guidFor(bar); // true
Basically, {{#with content}}{{#each releases}}Mac OS X {{version}}: {{name}} {{/each}}{{/with}}
will not render anything when the view has a content property who has an array in its releases
property:
var view = SC.View.create({
template: SC.Handlebars.compile('{{#if content.releases}}{{#each content.releases}}Mac OS X {{version}}: {{name}} {{/each}}{{/if}}'),
content: {
releases: [ { version: '10.7',
name: 'Lion' },
{ version: '10.6',
name: 'Snow Leopard' },
{ version: '10.5',
name: 'Leopard' } ]
}
});
I've written a couple specs that show more detail here: https://gist.github.com/1049557
If this is a bug, and not an error on my part, I'd be happy to work on a fix.
I have just updated an app to the latest version of Sproutcore2 and it's broken a few things. I don't know yet exactly what is causing the breakage but I have test case to demonstrate it, below.
I've verified that this test used to pass and that it's now failing. The commit that introduced the breaking change is 4e7bf9e
The test is failing because the structure of the html generated by the nested collections is incorrect.
In the test, there are two sets of bindings in play.
TemplateTests.contentController
and TemplateTests.OuterList
TemplateTests.InnerList
and TemplateTests.OuterListItem
if you remove either of these bindings then the test passes.
test("should render multiple, bound nested collections", function() {
TemplateTests.contentController = SC.ArrayProxy.create({
content: ['foo','bar']
});
TemplateTests.InnerList = SC.CollectionView.extend({
tagName: 'ul',
contentBinding: 'parentView.innerListContent'
});
TemplateTests.OuterListItem = SC.View.extend({
template: SC.Handlebars.compile('{{#collection TemplateTests.InnerList class="inner"}}{{content}}{{/collection}}{{content}}'),
innerListContent: [1,2,3]
});
TemplateTests.OuterList = SC.CollectionView.extend({
tagName: 'ul',
contentBinding: 'TemplateTests.contentController',
itemViewClass: TemplateTests.OuterListItem
});
var view = SC.View.create({
template: SC.Handlebars.compile('{{collection TemplateTests.OuterList class="outer"}}')
});
SC.run(function() {
view.appendTo('#qunit-fixture');
});
equals(view.$('ul.outer > li').length, 2, "renders the outer list with correct number of items");
equals(view.$('ul.inner').length, 2, "renders the correct number of inner lists");
equals(view.$('ul.inner:first > li').length, 3, "renders the first inner list with correct number of items");
equals(view.$('ul.inner:last > li').length, 3, "renders the second list with correct number of items");
});
Trying the todo's sample with current Master gives the following error when you mark an item complete and hit the clear completed button. This issue is showing up for me when changing the sort order of a collection but is easiest to repro using the todos sample. Add two todos, mark one complete and hit the clear completed button.
Uncaught Error: assertion failed: You cannot set observed properties on destroyed objects
sc_assertsproutcore.js:1565
SC.Descriptor.MUST_USE_SETTERsproutcore.js:2491
setsproutcore.js:2005
setsproutcore.js:2030
SC.setPathsproutcore.js:2272
Binding.SC.Object.extend._syncsproutcore.js:8966
invokesproutcore.js:7901
itersproutcore.js:7946
RunLoop.SC.Object.extend.flushsproutcore.js:7987
RunLoop.SC.Object.extend.endsproutcore.js:7921
SC.run.endsproutcore.js:8066
SC.run.runsproutcore.js:8042
SC.EventDispatcher.SC.Object.extend.setupHandlersproutcore.js:9976
Njquery-1.6.1.min.js:16
f.event.handlejquery-1.6.1.min.js:17
f.event.add.k.i.handle.k
I regularly have ruby, gem and bundler related problems building the sroutcore20 stuff. By updating / resetting my tools and my environment things get sorted out most of the time.
right now I get the following error when trying to run "bundle exec rake"
Could not find libv8-3.3.10.2 in any of the sources
Perhaps this is intended (edit: it is intended, but not well documented), but it seems like in the documentation that the actual value should be passed to the helper.
Test = SC.Application.create();
Handlebars.registerHelper('simpleHelper', function( myProp, context) {
// this logs out as : `myProp string'
console.log( myProp, typeof myProp );
// I would expect to have the actual object
// myProp === { actual: 'object' } <-- true (if it was bound to something)
return 'output';
});
This is with the template:
<script type="text/html">
{{simpleHelper myProp}}
</script>
I know that's without data bindings for the property, so here's a more complex example with data: http://pastie.org/2117982
This one surprised me: computed properties always get recalculated immediately, even within beginPropertyChanges.
Is this an intended behavior? It would be nice to be able to batch up changes to keep recalculation to a minimum.
Reading the source, I don't understand why dependent keys have a different implementation from observers. It seems like we could implement dependent keys on top of observers, and then this issue would be fixed automatically, since observers respect beginPropertyChanges.
For amongst others, debugging purposes, it would be very handy to be able to easily dump a SC.Object into a JSON Hash.
.toString() isn't useful at all and there doesn't seem to be a toJSON. The closer the SC.Object is to a PoJSo object, the handier.
We talked about looking for opportunities to improve errors, well here's a boiled down version of something I just spent an embarrassing amount of time trying to fix in my app: http://jsfiddle.net/8yVmt/
Note the error in the console. There are no obvious clues as to what part of the code is causing the issue, nor is there much insight into what the problem might be ("unknown mixin"?).
So... yeah... I put ArrayProxy.extend rather than .create. That is clearly foolish. This issue is a request that the resulting error do more to help me track down my foolishness.
I feel like there is a strong case for putting some effort into improving this flavor of error: I effectively just typo-ed this and had trouble finding my problem; imagine how mysterious this would be for a beginner who's fuzzy on the difference between extend and create.
There is no amber directory.
Running spade update
inside the repo root dir gives an error:
ejb-mbp2:sproutcore20 ebryn$ spade update
/Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:79:in read': Too many levels of symbolic links - /Users/ebryn/Dev/repos/sproutcore20/.spade/packages/handlebars/package.json (Errno::ELOOP) from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:79:in
gen_spade_boot'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:77:in map' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:77:in
gen_spade_boot'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:67:in update' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:66:in
open'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/bundle.rb:66:in update' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/lib/spade/cli/base.rb:120:in
update'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/thor-0.14.6/lib/thor/task.rb:22:in send' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/thor-0.14.6/lib/thor/task.rb:22:in
run'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/thor-0.14.6/lib/thor/invocation.rb:118:in invoke_task' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/thor-0.14.6/lib/thor.rb:263:in
dispatch'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/thor-0.14.6/lib/thor/base.rb:389:in start' from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/gems/spade-0.0.7/bin/spade:7 from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/bin/spade:19:in
load'
from /Users/ebryn/.rvm/gems/ree-1.8.7-2010.02/bin/spade:19
Running spade preview
works from the repo root dir, but tests aren't running when navigating to the test URL. From the web inspector ot looks like spade-boot.js is empty. Tested with Chrome 12 and Safari 5.
The recent changes to the way that views get rendered, ie. waiting for the bindings to synchronise first, seems to have broken the rendering of nested collections.
I have written a failing test case to illustrate the issue: https://github.com/crofty/sproutcore20/commit/2ed7a8f1866ec94ef545f31efdc6e2f502396d57
The equivalent test case passes when run against the code prior to commit that introduced the view changes (https://github.com/sproutcore/sproutcore20/commit/f62a9f1cd98c8dcf0ee1be0eacd2a67d13278248)
In my app, I'm using this form of nested collections a lot, i.e. binding the content of the view to some property of the parent view. Is this the correct way of doing it? Is the bug valid or is there a different way to do nested collections?
Using sproutcore-2.0.a.2.js inside an existing HTML page.
I rendered a collection nested inside a form tag. A form submission is triggered when clicking on an SC.Button. If I move the collection outside of the form tag it works as expected.
I'm learning sproutcore, so maybe that's something I'm doing wrong, but after I asked in the IRC channel and no one had an answer to give me I think maybe it's a bug.
So, I modified the todo sample app to include a button that would remove the task like so:
{{#collection ... }}
{{#view SC.Buton target="Todos.todosController" action="removeTodo" }}Remove{{/view}}
{{/collection}}
and in the controller:
removeTodo : function(btn)
{
var todo = this.getPath('.parentView.content');
this.removeObject(todo);
}
Although it removes the task, it gives an error doing so. Telling me that I can't set an observer in a destroyed object.
Probably because the event sender is being removed in its on callback. Using a timeout of 100ms to execute the action solved the problem, but that doesn't sound right.
sproutcore-runtime tests are failing with the following error:
Uncaught TypeError: Cannot call method 'extend' of undefined
(anonymous function)sproutcore-runtime/~tests/system/native_array/suite_test:7
execFactoryspade.js:230
Sp.requirespade.js:377
requirespade.js:175
(anonymous function)qunit/qunit-runner:42
execFactoryspade.js:230
Sp.requirespade.js:377
Tp.requirespade.js:966
(anonymous function)spade-boot.js:1048
Tp.readyspade.js:1106
Lp.scheduleReady.handler
SC.MutableArrayTests
is the undefined it's complaining about.
Note that I'm not following the current readme instructions since bpm autocompile
gives me 'You do not appear to be inside of a bpm project' and bpm preview
gives me 'Could not find task "preview".' I'm running with spaderun update; spaderun preview
, so apologies if that's the wrong method right now and this is a non-issue.
Also, I'm on Ubuntu 11.04 if it makes a difference.
The require variable is defined in sproutcore-runtime but required in sproutcore-metal. Sproutcore-Runtime list Sproutcore-Metal as a dependency.
Hi,
here's an example of this issue: http://jsfiddle.net/CzXMS/1 The example uses alpha 4, but the same issue is on the master branch - I just couldn't find public URL to a newer version anywhere.
If you run it, it raises Uncaught TypeError: Cannot read property 'ChildView' of undefined
error in the console. It's looking for the global MyApp
object in Handlebars.helpers
or in currentContext
, which in this case is MyApp.ParentView
and of course can't find it in any of these objects.
When a property is changed by a binding synchronizing, observesBefore does not get called until after all bindings finish flushing. Effectively, this means that "before" observers get called at the same time as "regular" observers.
I believe this is due to the fact that observer notifications are suspended until after bindings flush.
window.X = SC.Object.create({ [1,2], y: function() { var sum = 0; this.get('x').forEach(function(i) { sum = sum + i }); return sum; }.property('x.@each') })
Class
window.Y = SC.Object.create({ yBinding: "X.y" })
Class
Y.get('y')
3
X.get('x').pushObject(4)
4
Y.get('y')
3
window.X = SC.Object.create({ [1,2], y: function() { var sum = 0; this.get('x').forEach(function(i) { sum = sum + i }); return sum; }.property('x.length') })
Class
window.Y = SC.Object.create({ yBinding: "X.y" })
Class
Y.get('y')
3
X.get('x').pushObject(4)
4
Y.get('y')
7
Using ".@each" instead of ".length" on an array attribute makes the computed properly not update as expected.
There are couple of .DS_Store files in your code tree. You may want to get rid of them and adjust ".gitignore"
I have a situation in which a child view is getting destroyed during its own createElement method.
createElement calls renderToBuffer calls SC.run.sync which destroys the view. So when control returns to createElement we try to set(this, 'element') on a destroyed object and hit an assertion.
The view in question is the child of an SC.CollectionView. It looks like two rapid changes to the contents of the collection can cause this behavior: the first change causes SC.CollectionView to create a new child and call its createElement, then the second change hits and the collection tries to destroy the new child before it has finished being created.
It's also possible that I'm only seeing these two rapid changes because I'm misusing bindings & queries in some way. If there's something inherent to sproutcore's architecture that's supposed to prevent this kind of race, I must have found a way to subvert it, so at the least there's probably an opportunity to add a new assertion.
The redefineProperty check in SC.platform fails with an error when IE doesn't define Object.defineProperty (<8 and older render modes). The check assumes Object.defineProperty is a function to begin with. Additionally, when it is in IE8 standards mode it also fails because the test attempts to define a property on a normal object (IE8 defineProperty only works on DOM elements).
I was able get around it with the following:
https://github.com/yozora/sproutcore20/commit/de8a783b56f22aeb6cb4fb79df3c940c12cc5607
The following trivial application fails to launch on Android (both 2.3.3 and 3.0.1):
<html>
<body>
<script type="text/html">Test</script>
<script type="text/javascript" src="/javascripts/jquery.js"></script>
<script type="text/javascript" src="/javascripts/sproutcore.js"></script>
</body>
</html>
Here is a stacktrace I was able to obtain via adb with the help of stacktrace.js:
I/browser ( 3232): sc_assert (http://hasufel/javascripts/sproutcore.js:1573:38)
I/browser ( 3232): [object Object].<anonymous> (http://hasufel/javascripts/sproutcore.js:2528:7)
I/browser ( 3232): defineProperty (native)
I/browser ( 3232): [object Object].setup (http://hasufel/javascripts/sproutcore.js:2481:3)
I/browser ( 3232): Object.defineProperty (http://hasufel/javascripts/sproutcore.js:2702:10)
I/browser ( 3232): Object.unwatch (http://hasufel/javascripts/sproutcore.js:3824:20)
I/browser ( 3232): removeDependentKey (http://hasufel/javascripts/sproutcore.js:2844:6) http://hasufel/javascripts/sproutcore.js:1573
E/browser ( 3232): Console: Uncaught Error: assertion failed: Must use SC.set() to access this property http://hasufel/javascripts/sproutcore.js:1573
As you can see, the browser's native Object.defineProperty is invoking the setter which is intended to never be invoked.
I'm using sproutcore.js built from the very latest master (cc5a43b).
Tested with IE 7, 8, and 9.
Looks like a spade related issue. Issue also filed there: https://github.com/sproutcore/spade/issues/1
I've been fighting a bug for a few hours when I realized that my expectations of computed properties were wrong.
Basically, I was creating an array in a computed property, then I was rendering each collection element. When click on, the element view would modify itself, but the computed property was not updated which drove me crazy.
I was under the (wrong) assumption that using a computed property would NOT recreate a new object every time. The solution was of course to use cacheable() on my computed property.
Please consider using cacheable by default since it would probably save a lot of frustration.
Hi,
here are 2 examples from discussion on Google group (https://groups.google.com/d/topic/sproutcore/f5eO-f_R0c4/discussion):
resources
array is shared among all instances of App.O
status
attribute of element of resources
array changesIn the tutorial, you indicate to download a new css file, create the "todos.css" and link to it in the head of the index. The new css has calls to compass which do not work in the demo. Also, in the "getting things done" section - the 2nd code example - you are missing 1 handlebar at the beginning of the code.
I've got another issue in my app relating to collection views. I've reduced it down to a failing test case which is below. I've run the test against previous versions of the code and verifed that it used to pass.
The breaking change was introduced in 0ae26af.
What I am trying to do is render a CollectionView within a view that has bindings to an object - datasetController
. When I swap out the dataset for another one, I'd expect the rendered html to update to reflect the new dataset. Instead, I'm getting the following error:
You can't insert an element into the DOM that has already been inserted
Test case is:
test("should allow view objects to be swapped out without throwing an error", function() {
var view, dataset, secondDataset;
SC.run(function() {
TemplateTests.datasetController = SC.Object.create();
TemplateTests.ReportingView = SC.View.extend({
datasetBinding: 'TemplateTests.datasetController*dataset',
readyBinding: 'dataset.ready',
itemsBinding: 'dataset.items',
template: SC.Handlebars.compile("{{#if ready}}{{collection TemplateTests.CollectionView}}{{else}}Loading{{/if}}")
});
TemplateTests.CollectionView = SC.CollectionView.extend({
contentBinding: 'parentView.parentView.items',
tagName: 'ul',
template: SC.Handlebars.compile("{{content}}")
});
view = TemplateTests.ReportingView.create();
});
SC.run(function() {
view.appendTo('#qunit-fixture');
});
equals(view.$().text(), "Loading", "renders the loading text when the dataset is not ready");
SC.run(function() {
dataset = SC.Object.create({
ready: true,
items: [1,2,3]
});
TemplateTests.datasetController.set('dataset',dataset);
});
equals(view.$('ul > li').length, 3, "renders the collection with the correct number of items when the dataset is ready");
SC.run(function() {
secondDataset = SC.Object.create({ready: false});
TemplateTests.datasetController.set('dataset',secondDataset);
});
equals(view.$().text(), "Loading", "renders the loading text when the second dataset is not ready");
});
on my setup (mac, ruby 1.9.2p180), rake fails with the following error message:
rake aborted!
invalid byte sequence in US-ASCII
So I hacked into the Rakefile this command:
Encoding.default_external = Encoding.find("UTF-8") </code/>
and it worked, but I am not sure whether this is the right approach ...
Here's an example: http://jsfiddle.net/szimek/pPSUk/6
With isValueBinding
instead of toggleVisibility
function it works fine. Not sure if it's a bug or not...
I tested out the Starter Kit and SC.generateGuid causes a TypeError.
"TypeError: defineProperty is not supported on DOM Objects"
This seems to be working fine on the latest version of Chrome and Firefox 5 Beta.
Hi,
I want to get the SC 2.0 unit tests up and running and the information in the readme seems outdated. Installing the spade gem doesn't add a spadepkg binary. That seems to have been superseeded by bpm. But the only package bpm seems to know about (via bpm list) is spade 0.1.2. I've also tried installing the spade-packager gem, but that doesn't work either. So before I keep trying, I thought I'd just kindly ask you to point me in the right direction and/or update the info in the Readme file.
Thanks!
Johannes
Not entirely sure if this is intended behavior moving forward but SC.Button won't accept paths relative to itself as target property, e.g.
{{#view SC.Button target="parentView" action="togglePlayState"}}
Play
{{/view}}
Thinking of buttons used in larger components like controls for audio/video tags. Adding this
as the root
argument at https://github.com/sproutcore/sproutcore20/blob/master/packages/sproutcore-handlebars/lib/controls/button.js#L21 changes the behavior to enable relative path lookup and retains global lookup.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.