Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings after Ember upgrade #332

Merged
merged 1 commit into from
Mar 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/controllers/container-types.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from "ember";
var ArrayController = Ember.ArrayController;
const { Controller, computed: { sort } } = Ember;

export default ArrayController.extend({
sortProperties: ['name']
export default Controller.extend({
sortProperties: ['name'],
sorted: sort('model', 'sortProperties')
});
4 changes: 4 additions & 0 deletions app/controllers/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Ember from 'ember';
const { Controller} = Ember;

export default Controller;
8 changes: 6 additions & 2 deletions app/controllers/model-types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Ember from "ember";
export default Ember.ArrayController.extend({
const { Controller, computed: { sort } } = Ember;

export default Controller.extend({
navWidth: 180,
sortProperties: ['name']
sortProperties: ['name'],

sorted: sort('model', 'sortProperties')
});
4 changes: 2 additions & 2 deletions app/controllers/records.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Ember from "ember";
import escapeRegExp from "ember-inspector/utils/escape-reg-exp";
const { computed } = Ember;
const { Controller, computed } = Ember;
const { none, alias } = computed;

export default Ember.ArrayController.extend({
export default Controller.extend({
needs: ['application'],

queryParams: ['filterValue', 'search'],
Expand Down
12 changes: 5 additions & 7 deletions app/controllers/render-tree.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Ember from "ember";
import escapeRegExp from "ember-inspector/utils/escape-reg-exp";
import debounceComputed from "ember-inspector/computed/debounce";
var get = Ember.get;
var isEmpty = Ember.isEmpty;
var and = Ember.computed.and;
var equal = Ember.computed.equal;
var filter = Ember.computed.filter;

export default Ember.ArrayController.extend({
const { get, isEmpty, computed, Controller } = Ember;
const { and, equal, filter } = computed;

export default Controller.extend({
needs: ['application'],

initialEmpty: false,
Expand All @@ -25,7 +23,7 @@ export default Ember.ArrayController.extend({
return escapeRegExp(this.get('search').toLowerCase());
}.property('search'),

arrangedContent: filter('model', function(item) {
filtered: filter('model', function(item) {
var search = this.get('escapedSearch');
if (isEmpty(search)) {
return true;
Expand Down
9 changes: 5 additions & 4 deletions app/templates/container-types.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="split">

{{#draggable-column
width=180
classNames="split__panel split__panel--sidebar-2 nav"}}
Expand All @@ -9,11 +10,11 @@
</div>

<ul>
{{#each}}
{{#each sorted as |containerType|}}
<li data-label="container-type">
{{#link-to "container-type" name}}
<span data-label="container-type-name">{{name}}</span>
(<span data-label="container-type-count">{{count}}</span>)
{{#link-to "container-type" containerType.name}}
<span data-label="container-type-name">{{containerType.name}}</span>
(<span data-label="container-type-count">{{containerType.count}}</span>)
{{/link-to}}
</li>
{{/each}}
Expand Down
6 changes: 3 additions & 3 deletions app/templates/info.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<div class="list-view__list-container">
<div class="list-tree">
<div class="ember-list-container">
{{#each}}
{{#each model as |library|}}
<div data-label="library-row" class="list-tree__item-wrapper row-wrapper">
<div class="list-tree__item row">
<div class="cell_type_main cell cell_size_large">
<span data-label="lib-name">{{unbound name}}</span>
<span data-label="lib-name">{{unbound library.name}}</span>
</div>
<div class="cell">
<span data-label="lib-version">{{unbound version}}</span>
<span data-label="lib-version">{{unbound library.version}}</span>
</div>
</div>
</div>
Expand Down
24 changes: 12 additions & 12 deletions app/templates/mixin-details.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
{{/if}}
{{#if mixin.isExpanded}}
<ul class="mixin__properties">
{{#each mixin.properties itemController="mixinProperty"}}
<li {{bind-attr class="overridden:mixin__property_state_overridden :mixin__property"}} data-label="object-property">
{{#if value.computed}}
<button {{bind-attr class=":mixin__calc-btn isCalculated:mixin__calc-btn_calculated"}} {{action "calculate" model bubbles=false}} data-label="calculate"><img src="assets/images/calculate.svg"></button>
{{#each mixin.properties itemController="mixinProperty" as |property|}}
<li {{bind-attr class="property.overridden:mixin__property_state_overridden :mixin__property"}} data-label="object-property">
{{#if property.value.computed}}
<button {{bind-attr class=":mixin__calc-btn property.isCalculated:mixin__calc-btn_calculated"}} {{action "calculate" property.model bubbles=false}} data-label="calculate"><img src="assets/images/calculate.svg"></button>
{{else}}
<span class='pad'></span>
{{/if}}
<span class='mixin__property-name' data-label="object-property-name">{{name}}</span><span class='mixin__property-value-separator'>: </span>
{{#unless isEdit}}
<span {{action "valueClick" model}} {{bind-attr class="value.type :mixin__property-value"}} data-label="object-property-value">{{value.inspect}}</span>
<span class='mixin__property-name' data-label="object-property-name">{{property.name}}</span><span class='mixin__property-value-separator'>: </span>
{{#unless property.isEdit}}
<span {{action "valueClick" property.model}} {{bind-attr class="property.value.type :mixin__property-value"}} data-label="object-property-value">{{property.value.inspect}}</span>
{{else}}
{{#unless isDate}}
{{property-field value=txtValue finished-editing="finishedEditing" save-property="saveProperty"
{{#unless property.isDate}}
{{property-field value=property.txtValue finished-editing="finishedEditing" save-property="saveProperty"
class="mixin__property-value-txt" label="object-property-value-txt"}}
{{else}}
{{date-property-field value=dateValue format="YYYY-MM-DD" finished-editing="finishedEditing" save-property="saveProperty"
{{date-property-field value=property.dateValue format="YYYY-MM-DD" finished-editing="finishedEditing" save-property="saveProperty"
class="mixin__property-value-txt" label="object-property-value-date"}}
{{/unless}}
{{/unless}}
<span class='mixin__property-overridden-by'>(Overridden by {{overridden}})</span>
<button class="mixin__send-btn" {{action "sendToConsole" model}} data-label="send-to-console-btn"><img src="assets/images/send.png" title="Send to console"></button>
<span class='mixin__property-overridden-by'>(Overridden by {{property.overridden}})</span>
<button class="mixin__send-btn" {{action "sendToConsole" property.model}} data-label="send-to-console-btn"><img src="assets/images/send.png" title="Send to console"></button>
</li>
{{else}}
<li class="mixin__property">No Properties</li>
Expand Down
8 changes: 4 additions & 4 deletions app/templates/model-types.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<div class="split__panel__bd">
<div class="nav__title"><h3>Model Types</h3></div>
<ul>
{{#each}}
{{#each sorted as |modelType|}}
<li data-label="model-type">
{{#link-to "records" name}}
<span data-label="model-type-name">{{name}}</span>
(<span data-label="model-type-count">{{count}}</span>)
{{#link-to "records" modelType.name}}
<span data-label="model-type-name">{{modelType.name}}</span>
(<span data-label="model-type-count">{{modelType.count}}</span>)
{{/link-to}}
</li>
{{/each}}
Expand Down
8 changes: 5 additions & 3 deletions app/templates/records-toolbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<div class="divider"></div>

{{#each filters itemController="recordFilter"}}
<button data-label="filter" {{bind-attr class="checked:active :toolbar__radio"}} {{action "setFilter" name}} >{{desc}}</button>
{{#each filters itemController="recordFilter" as |filter|}}
<button data-label="filter" {{bind-attr class="filter.checked:active :toolbar__radio"}} {{action "setFilter" filter.name}} >
{{filter.desc}}
</button>
{{/each}}
</div>
</div>
4 changes: 2 additions & 2 deletions app/templates/records.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="list-view">
<div class="list-view__header row">
{{#each columns}}
<div class="cell cell_type_header" data-label="column-title">{{desc}}</div>
{{#each columns as |column|}}
<div class="cell cell_type_header" data-label="column-title">{{column.desc}}</div>
{{/each}}

<!-- Account for scrollbar width :'( -->
Expand Down
4 changes: 2 additions & 2 deletions app/templates/render-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>
{{#if isExpanded}}
{{#each children}}
{{render "render_item" this}}
{{#each children as |child|}}
{{render "render_item" child}}
{{/each}}
{{/if}}
4 changes: 2 additions & 2 deletions app/templates/render-tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<div class="ember-list-container">
{{#view "render-list"}}
{{#each}}
{{render "render-item" this}}
{{#each filtered as |item|}}
{{render "render-item" item}}
{{/each}}
{{/view}}
</div>
Expand Down
4 changes: 3 additions & 1 deletion tests/ember_debug/object_inspector_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function setupApp(){
this.route('simple');
});

Ember.TEMPLATES.simple = compile('Simple {{input class="simple-input"}} {{view Ember.View classNames="simple-view"}}');
App.SimpleView = Ember.View;

Ember.TEMPLATES.simple = compile('Simple {{input class="simple-input"}} {{view "simple" classNames="simple-view"}}');
}

module("Ember Debug - Object Inspector", {
Expand Down
8 changes: 6 additions & 2 deletions tests/ember_debug/view_debug_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,22 @@ test("Simple View Tree", function(assert) {
});


test("Views created by {{each}} helper are shown", function(assert) {
var name = null, message = null;
test("Views created by context switching {{each}} helper are shown", function(assert) {
let name = null, message = null;
port.reopen({
send: function(n, m) {
name = n;
message = m;
}
});

// Disable deprecation warning of context switching each helper
const originalDeprecate = Ember.deprecate;
Ember.deprecate = Ember.K;
visit('/comments');

andThen(function() {
Ember.deprecate = originalDeprecate;
var tree = message.tree;
var comments = tree.children[0].children;
assert.equal(comments.length, 3, "There should be 3 views");
Expand Down