Skip to content

Commit

Permalink
Merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Pinzon committed May 30, 2011
2 parents 2c082c7 + 24f320a commit 973d197
Show file tree
Hide file tree
Showing 65 changed files with 3,095 additions and 1,171 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,42 @@
CHANGE LOG FOR 1.6
==================

1.6.0.rc.2
----------
* Fixed SC.PickerPane#modalPaneDidClick return values - Fixes #339
* Fixed SC.Enumerable fallback for SC.RecordArray#find - Fixes #363
* Added SC.requiredObjectForPropertyPath that throws an error when object can't be found
* Make it possible for the handlebars helpers to generate tags other than <span>
* Improved Observer Tests with better location (thx martoche)
* Fixed disclosure positioning in Ace, fixes #457
* Added backslash to prevent SASS comment interpolation warning
* Allow for passing relative paths to #collection helper.
* Further cleanup to TextField template multiline
* Added isMultiline property to SC.TextField.
* jQuery is now smart enough to take booleans for certain attributes
* Stop using jQuery expando
* Added unit tests for SC.ContainerView to verify it cleans up views that it instantiates.
* SC.ContainerView will instantiate it's contentView if nowShowing is set with a string or class, however it was not cleaning up views when it was finished. Now it keeps track and cleans up when necessary.
* Unit test for previous commit checking that the themeName got passed through to the buttons.
* Allow you to set themeName on the AlertPane to also set the themeName on the buttons (which were previously stuck as 'capsule')
* Unit test for previous commit adding controlSize to TabView + removed useless TabView methods test and left a warning unit test instead.
* Whitespace + allow setting of controlSize
* Comment typo forEachIndex is not a function in IndexSet
* fix jQuery/SC conflict for events handeling add tryToPerform on SC.TextField
* use prop instead of attr in SC.Checkbox replace SC.data with jQuery.data
* remove more code : passing unit tests but fail in real app
* upgrade to jquery 1.6 use jQuery.sub()
* Minor adjustments for docs
* fixed so that replace on ChildArray only notifies the part of the array that has actually changed
* remove more code : passing unit tests but fail in real app
* upgrade to jquery 1.6 use jQuery.sub()
* Hacky solution to the issue where template collection views render their item views multiple times when they are nested inside another template collection view.
* Adds support for specifying an inverse template name to template collection view.
* Adds unit tests for using an inverse template in template collection views.
* Fixes issue with nested template collection views causing childViews array to get messed up.
* Adds failing unit test for childView structure of nested collection views.
* Adds unit tests for checking the number of items rendered in nested collection views with default content.

1.6.0.rc.1
----------
* Added 'Show Progress' checkbox to Test Runner
Expand Down
4 changes: 2 additions & 2 deletions frameworks/ajax/system/response.js
Expand Up @@ -184,9 +184,9 @@ SC.Response = SC.Object.extend(

/**
@private
@deprecated
@deprecated Use body instead.
Alias for body. Provides compatibility with older code.
Alias for body.
@type Hash|String
@see #body
Expand Down
3 changes: 2 additions & 1 deletion frameworks/core_foundation/ext/handlebars/bind.js
Expand Up @@ -51,7 +51,8 @@ sc_require('ext/handlebars');
displayTemplate: fn,
inverseTemplate: inverse,
property: property,
previousContext: this
previousContext: this,
tagName: (options.hash.tagName || "span")
});

var observer, invoker;
Expand Down
Expand Up @@ -77,8 +77,12 @@ SC.TextField = SC.TemplateView.extend(
var input = this.$input();

if (value !== undefined) {
this._value = value;
input.val(value);
// We don't want to unnecessarily set the value.
// Doing that could cause the selection to be lost.
if (this._value !== value || input.val() !== value) {
this._value = value;
input.val(value);
}
} else if (input.length) {
this._value = value = input.val();
} else {
Expand Down Expand Up @@ -135,8 +139,12 @@ SC.TextFieldSupport = /** @scope SC.TextFieldSupport */{
var input = this.$('input');

if (value !== undefined) {
this._value = value;
input.val(value);
// We don't want to unnecessarily set the value.
// Doing that could cause the selection to be lost.
if (this._value !== value || input.val() !== value) {
this._value = value;
input.val(value);
}
} else {
if (input.length > 0) {
value = this._value = input.val();
Expand Down
34 changes: 25 additions & 9 deletions frameworks/core_foundation/panes/template.js
Expand Up @@ -5,20 +5,31 @@
// License: Licensed under MIT license (see license.js)
// ==========================================================================

/**
/** @class
SC.TemplatePane is a helper that will create a new pane based on
a single root TemplateView.
function main() {
MyApp.mainPane = SC.TemplatePane.append({
layerId: 'my-root-id',
templateName: 'app'
})
}
function main() {
MyApp.mainPane = SC.TemplatePane.append({
layerId: 'my-root-id',
templateName: 'app'
})
}
@extends SC.Object
@since SproutCore 1.5
*/
SC.TemplatePane = SC.Object.extend({});

SC.mixin(SC.TemplatePane, {
SC.TemplatePane.mixin( /** @scope SC.TemplatePane */ {

/**
Creates a new pane with a single TemplateView.
@param {Object} attrs describes the pane to create
@returns {SC.MainPane} the created pane
*/
append: function(attrs) {
var pane = SC.MainPane.extend({
childViews: ['contentView'],
Expand All @@ -38,6 +49,11 @@ SC.mixin(SC.TemplatePane, {
}
});

return pane.create().append();
pane = pane.create().append();

// Normally the awake process is started in the Page, but we don't have a Page
pane.awake();

return pane;
}
});
3 changes: 2 additions & 1 deletion frameworks/core_foundation/system/render_context.js
Expand Up @@ -50,7 +50,8 @@ SC.COMBO_STYLES = {
context.begin() <-- begins a new tag context
context.end() <-- ends the tag context...
*/
SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
SC.RenderContext = SC.Builder.create(
/** @lends SC.RenderContext */ {

SELF_CLOSING: SC.CoreSet.create().addEach(['area', 'base', 'basefront', 'br', 'hr', 'input', 'img', 'link', 'meta']),

Expand Down
6 changes: 4 additions & 2 deletions frameworks/core_foundation/system/utils.js
Expand Up @@ -152,8 +152,10 @@ SC.mixin( /** @scope SC */ {
return result;
},

/** @deprecated
Deprecated. SC.offset() is more accurate, more flexible in the value for the element parameter and
/**
@deprecated Use SC.offset instead.
SC.offset() is more accurate, more flexible in the value for the element parameter and
easier to understand.
@param el The DOM element
Expand Down
Expand Up @@ -38,6 +38,10 @@
equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
});

// Not really sure how to test this without doing something like adding a selection then checking
// to see if it's still there after setting value
test("only update DOM if value changed");

test("value binding works properly for inputs that haven't been created", function() {
var view = SC.TemplateView.create(SC.TextFieldSupport, {
template: SC.Handlebars.compile('<input type="text">'),
Expand Down Expand Up @@ -74,7 +78,7 @@
equals(focusCalled, 1, "focus called after field receives focus");

textFieldView.$('input').blur();
equals(blurCalled, 1, "blur alled after field blurs");
equals(blurCalled, 1, "blur called after field blurs");
});

test("calls correct method for key events", function() {
Expand Down Expand Up @@ -130,6 +134,10 @@
equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
});

// Not really sure how to test this without doing something like adding a selection then checking
// to see if it's still there after setting value
test("only update DOM if value changed");

test("value binding works properly for inputs that haven't been created", function() {
var view = SC.TextField.create({
valueBinding: 'TestObject.value'
Expand Down Expand Up @@ -165,7 +173,7 @@
equals(focusCalled, 1, "focus called after field receives focus");

textFieldView.$('input').blur();
equals(blurCalled, 1, "blur alled after field blurs");
equals(blurCalled, 1, "blur called after field blurs");
});

test("calls correct method for key events", function() {
Expand Down
17 changes: 16 additions & 1 deletion frameworks/core_foundation/tests/panes/template.js
Expand Up @@ -9,7 +9,6 @@ module("Template Panes");
test("Template panes append a main pane to the document body", function() {
var pane = SC.TemplatePane.append({
layerId: 'template-panes-are-so-cool',

template: SC.Handlebars.compile('<h1>foo bar baz</h1>')
});

Expand All @@ -18,3 +17,19 @@ test("Template panes append a main pane to the document body", function() {

pane.remove();
});

test("Template panes should be awoken", function(){
var didAwake = false;

var originalAwake = SC.MainPane.prototype.awake; // null for now, but just in case
SC.MainPane.prototype.awake = function(){ didAwake = true; }

var pane = SC.TemplatePane.append({
layerId: 'template-panes-are-so-cool',
template: SC.Handlebars.compile('<h1>foo bar baz</h1>')
});

SC.MainPane.prototype.awake = originalAwake;

ok(didAwake, "should have awoken the pane");
});
20 changes: 18 additions & 2 deletions frameworks/core_foundation/tests/views/view/didAppendToDocument.js
Expand Up @@ -21,6 +21,7 @@ module("SC.View#didAppendToDocument", {
context.push('new string');
},
didAppendToDocument: function(){
ok(document.getElementById(this.get('layerId')), "view layer should exist");
counter++;
}
})
Expand All @@ -30,6 +31,7 @@ module("SC.View#didAppendToDocument", {

additionalView = SC.View.create({
didAppendToDocument: function(){
ok(document.getElementById(this.get('layerId')), "additionalView layer should exist");
counter++;
}
});
Expand Down Expand Up @@ -59,11 +61,12 @@ test("Check that didAppendToDocument gets called at the right moment", function(
equals(counter, 3, "");
});


// Test for bug: when a childView has a non-fixed layout and we request its frame before the parentView has
// a layer and the parentView uses static layout, then the frame returned will be {x: 0, y:0, width: 0, height: 0}
// and any further requests for the childView's frame will not return a new value unless the parentViewDidChange
// or parentViewDidResize. A weird case, but we prevent it from failing anyhow.
test("Check that childView is updated if we have static layout and they don't have a fixed layout", function() {
test("Check that childView is updated if the pane has a static layout and view doesn't have a fixed layout", function() {
var childFrame,
wrongFrame = {x:0, y:0, width: 0, height: 0},
correctFrame;
Expand All @@ -80,4 +83,17 @@ test("Check that childView is updated if we have static layout and they don't ha
correctFrame = pane.get('frame');

same(childFrame, correctFrame, 'getting frame after layer exists on non-fixed layout childView should return actual frame');
});
});


test("Check that childView is updated if it has a static layout", function() {
var childFrame,
wrongFrame = {x:0, y:0, width: 0, height: 0},
correctFrame;

view.set('useStaticLayout', YES);

equals(counter, 0, "precond - has not been called yet");
pane.append(); // make sure there is a layer...
equals(counter, 1, "didAppendToDocument was called once");
});
2 changes: 1 addition & 1 deletion frameworks/core_foundation/views/view.js
Expand Up @@ -1241,7 +1241,7 @@ SC.CoreView.reopen(

});

SC.CoreView.mixin(/** @scope SC.View.prototype */ {
SC.CoreView.mixin(/** @scope SC.CoreView.prototype */ {

/** @private walk like a duck -- used by SC.Page */
isViewClass: YES,
Expand Down
22 changes: 14 additions & 8 deletions frameworks/core_foundation/views/view/manipulation.js
Expand Up @@ -126,16 +126,22 @@ SC.View.reopen(
if(view.parentViewDidChange) view.parentViewDidChange();
if(view.layoutDidChange) view.layoutDidChange();

var pane = view.get('pane');
if(pane && pane.get('isPaneAttached')) {
view._notifyDidAppendToDocument();
}
view.endPropertyChanges();

// notify views
if (this.didAddChild) { this.didAddChild(view, beforeView) ; }
if (view.didAddToParent) { view.didAddToParent(this, beforeView) ; }
// Make sure all notifications are delayed since the appending
// doesn't complete until the end of the RunLoop
// There may be better ways to do this than with invokeLast,
// but it's the best I can do for now - PDW
this.invokeLast(function(){
var pane = view.get('pane');
if(pane && pane.get('isPaneAttached')) {
view._notifyDidAppendToDocument();
}

view.endPropertyChanges();
// notify views
if (this.didAddChild) { this.didAddChild(view, beforeView) ; }
if (view.didAddToParent) { view.didAddToParent(this, beforeView) ; }
});

return this ;
},
Expand Down
14 changes: 12 additions & 2 deletions frameworks/datastore/data_sources/fixtures.js
Expand Up @@ -236,7 +236,7 @@ SC.FixturesDataSource = SC.DataSource.extend(
@param {SC.Store} store the store to load into
@param {SC.Record} recordType the record type to load
@param {SC.Array} ret is passed, array to add loaded storeKeys to.
@returns {SC.Fixture} receiver
@returns {SC.FixturesDataSource} receiver
*/
loadFixturesFor: function(store, recordType, ret) {
var hashes = [],
Expand Down Expand Up @@ -344,7 +344,17 @@ SC.FixturesDataSource = SC.DataSource.extend(
var ret = [], fixtures = this._fixtures[SC.guidFor(recordType)];
return fixtures ? YES: NO;
},


/**
Resets the fixtures to their original values.
@returns {SC.FixturesDataSource} receiver
*/
reset: function(){
this._fixtures = null;
return this;
},

/**
Returns YES or SC.MIXED_STATE if one or more of the storeKeys can be
handled by the fixture data source.
Expand Down

0 comments on commit 973d197

Please sign in to comment.