Skip to content

Instantly share code, notes, and snippets.

View ColinCampbell's full-sized avatar

Colin Campbell ColinCampbell

View GitHub Profile
diff --git a/frameworks/runtime/core.js b/frameworks/runtime/core.js
index 67bef70..a852a22 100644
--- a/frameworks/runtime/core.js
+++ b/frameworks/runtime/core.js
@@ -756,8 +756,37 @@ SC.mixin(/** @scope SC */ {
stringsFor: function(lang, strings) {
SC.mixin(SC.STRINGS, strings);
return this ;
- }
+ },
var record = MyApp.store.find(MyApp.Record, 1);
record.addObserver('status', this, function() {
if (record.get('status') === SC.Record.READY_CLEAN) {
record.removeObserver('status', this, arguments.callee);
// code here
}
});
SC.Request = SC.Request.extend({
_address: null,
address: function(key, value) {
if (value !== undefined) this._address = value;
else value = this._address;
return this.get('baseUrl') + value;
}
});
@ColinCampbell
ColinCampbell / main_page.js
Created March 9, 2011 00:26
/apps/test_app/resources/main_page.js
// ==========================================================================
// Project: TestApp - mainPage
// Copyright: ©2011 My Company, Inc.
// ==========================================================================
/*globals TestApp */
sc_require('views/tweet');
TestApp.mainPage = SC.Page.design({
diff --git a/frameworks/core_foundation/views/view/animation.js b/frameworks/core_foundation/views/view/animation.js
index 39f9c56..a14115c 100644
--- a/frameworks/core_foundation/views/view/animation.js
+++ b/frameworks/core_foundation/views/view/animation.js
@@ -86,21 +86,24 @@ SC.View.reopen(
value = hash[key];
cur = layout[key];
- if (cur !== value) { didChange = YES; }
+ if (cur !== value) {
diff --git a/frameworks/core_foundation/tests/views/view/animation.js b/frameworks/core_foundation/tests/views/view/animation.js
index fe6f663..b738b77 100644
--- a/frameworks/core_foundation/tests/views/view/animation.js
+++ b/frameworks/core_foundation/tests/views/view/animation.js
@@ -289,6 +289,32 @@ if (SC.platform.supportsCSSTransitions) {
SC.RunLoop.end();
});
+ test("should not add animation for properties that have the same value as existing layout", function() {
+ var callbacks = 0;
diff --git a/frameworks/core_foundation/tests/views/template_view/handlebars.js b/frameworks/core_foundation/tests/views/template_view/handlebars.js
index 8d80c05..626d0e8 100644
--- a/frameworks/core_foundation/tests/views/template_view/handlebars.js
+++ b/frameworks/core_foundation/tests/views/template_view/handlebars.js
@@ -578,3 +578,25 @@ test("should be able to bind boolean element attributes using {{bindAttr}}", fun
ok(view.$('input').attr('disabled'), 'attribute exists after update');
ok(!view.$('input').attr('checked'), 'attribute is not present after update');
});
+
+test("should be able to add multiple classes using {{bindAttr class}}", function() {
// controllers/accounts_page.js
MyApp.accountsPageController = SC.Object.create({
nowShowing: 'MyApp.accountsPage.defaultView'
});
// resources/main_page.js
Copyright (C) 2011 by Strobe Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in