Skip to content
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
3 changes: 0 additions & 3 deletions broccoli/amd-compat-entrypoints/ember.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ d('@ember/object/computed', emberObjectComputed);
import * as emberObjectCore from '@ember/object/core';
d('@ember/object/core', emberObjectCore);

import * as emberObjectEvented from '@ember/object/evented';
d('@ember/object/evented', emberObjectEvented);

import * as emberObjectEvents from '@ember/object/events';
d('@ember/object/events', emberObjectEvents);

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@
"@ember/object/compat.js": "ember-source/@ember/object/compat.js",
"@ember/object/computed.js": "ember-source/@ember/object/computed.js",
"@ember/object/core.js": "ember-source/@ember/object/core.js",
"@ember/object/evented.js": "ember-source/@ember/object/evented.js",
"@ember/object/events.js": "ember-source/@ember/object/events.js",
"@ember/object/index.js": "ember-source/@ember/object/index.js",
"@ember/object/internals.js": "ember-source/@ember/object/internals.js",
Expand Down
14 changes: 0 additions & 14 deletions packages/@ember/-internals/glimmer/lib/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -894,20 +894,6 @@ class Component<S = unknown>
return this.__dispatcher;
}

on<Target>(
name: string,
target: Target,
method: string | ((this: Target, ...args: any[]) => void)
): this;
on(name: string, method: ((...args: any[]) => void) | string): this;
on(name: string, target: any, method?: any) {
this._dispatcher?.setupHandlerForEmberEvent(name);
// The `on` method here comes from the Evented mixin. Since this mixin
// is applied to the parent of this class, however, we are still able
// to use `super`.
return super.on(name, target, method);
}

// Changed to `rerender` on init
_rerender() {
dirtyTag(this[DIRTY_TAG]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class AbstractAppendTest extends RenderingTestCase {
}
componentsByName[name] = this;
pushHook('init');
this.on('init', () => pushHook('on(init)'));
}

didReceiveAttrs() {
Expand Down Expand Up @@ -148,12 +147,10 @@ class AbstractAppendTest extends RenderingTestCase {
hooks,
[
['x-parent', 'init'],
['x-parent', 'on(init)'],
['x-parent', 'didReceiveAttrs'],
['x-parent', 'willRender'],
['x-parent', 'willInsertElement'],
['x-child', 'init'],
['x-child', 'on(init)'],
['x-child', 'didReceiveAttrs'],
['x-child', 'willRender'],
['x-child', 'willInsertElement'],
Expand Down Expand Up @@ -299,7 +296,6 @@ class AbstractAppendTest extends RenderingTestCase {
}
componentsByName[name] = this;
pushHook('init');
this.on('init', () => pushHook('on(init)'));
}

didReceiveAttrs() {
Expand Down Expand Up @@ -380,14 +376,7 @@ class AbstractAppendTest extends RenderingTestCase {

this.component = XParent.create({ foo: 'zomg' });

assert.deepEqual(
hooks,
[
['x-parent', 'init'],
['x-parent', 'on(init)'],
],
'creation of x-parent'
);
assert.deepEqual(hooks, [['x-parent', 'init']], 'creation of x-parent');

hooks.length = 0;

Expand All @@ -399,7 +388,6 @@ class AbstractAppendTest extends RenderingTestCase {
['x-parent', 'willInsertElement'],

['x-child', 'init'],
['x-child', 'on(init)'],
['x-child', 'didReceiveAttrs'],
['x-child', 'willRender'],
['x-child', 'willInsertElement'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { run } from '@ember/runloop';
import { DEBUG } from '@glimmer/env';
import { tracked } from '@ember/-internals/metal';
import { alias } from '@ember/object/computed';
import { on } from '@ember/object/evented';
import Service, { service } from '@ember/service';
import EmberObject, { set, get, computed, observer } from '@ember/object';
import { A as emberA } from '@ember/array';
Expand Down Expand Up @@ -3159,52 +3158,6 @@ moduleFor(
runTask(() => set(this.context, 'foo', 5));
}

['@test triggering an event only attempts to invoke an identically named method, if it actually is a function (GH#15228)'](
assert
) {
assert.expect(3);

let payload = ['arbitrary', 'event', 'data'];

this.registerComponent('evented-component', {
ComponentClass: Component.extend({
someTruthyProperty: true,

init() {
this._super(...arguments);
this.trigger('someMethod', ...payload);
this.trigger('someTruthyProperty', ...payload);
},

someMethod(...data) {
assert.deepEqual(
data,
payload,
'the method `someMethod` should be called, when `someMethod` is triggered'
);
},

listenerForSomeMethod: on('someMethod', function (...data) {
assert.deepEqual(
data,
payload,
'the listener `listenerForSomeMethod` should be called, when `someMethod` is triggered'
);
}),

listenerForSomeTruthyProperty: on('someTruthyProperty', function (...data) {
assert.deepEqual(
data,
payload,
'the listener `listenerForSomeTruthyProperty` should be called, when `someTruthyProperty` is triggered'
);
}),
}),
});

this.render(`{{evented-component}}`);
}

['@test component yielding in an {{#each}} has correct block values after rerendering (GH#14284)']() {
this.registerComponent('list-items', {
template: `{{#each this.items as |item|}}{{yield item}}{{/each}}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ class LifeCycleHooksTest extends RenderingTestCase {
assertNoElement('init', this);
assertState('init', 'preRender', this);

this.on('init', () => pushHook('on(init)'));

schedule('afterRender', () => {
this.isInitialRender = false;
});
Expand Down Expand Up @@ -336,19 +334,16 @@ class LifeCycleHooksTest extends RenderingTestCase {
// Sync hooks

['the-top', 'init'],
['the-top', 'on(init)'],
['the-top', 'didReceiveAttrs'],
['the-top', 'willRender'],
['the-top', 'willInsertElement'],

['the-middle', 'init'],
['the-middle', 'on(init)'],
['the-middle', 'didReceiveAttrs'],
['the-middle', 'willRender'],
['the-middle', 'willInsertElement'],

['the-bottom', 'init'],
['the-bottom', 'on(init)'],
['the-bottom', 'didReceiveAttrs'],
['the-bottom', 'willRender'],
['the-bottom', 'willInsertElement'],
Expand All @@ -368,15 +363,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
nonInteractive: [
// Sync hooks
['the-top', 'init'],
['the-top', 'on(init)'],
['the-top', 'didReceiveAttrs'],

['the-middle', 'init'],
['the-middle', 'on(init)'],
['the-middle', 'didReceiveAttrs'],

['the-bottom', 'init'],
['the-bottom', 'on(init)'],
['the-bottom', 'didReceiveAttrs'],
],
});
Expand Down Expand Up @@ -576,25 +568,21 @@ class LifeCycleHooksTest extends RenderingTestCase {
// Sync hooks

['the-parent', 'init'],
['the-parent', 'on(init)'],
['the-parent', 'didReceiveAttrs'],
['the-parent', 'willRender'],
['the-parent', 'willInsertElement'],

['the-first-child', 'init'],
['the-first-child', 'on(init)'],
['the-first-child', 'didReceiveAttrs'],
['the-first-child', 'willRender'],
['the-first-child', 'willInsertElement'],

['the-second-child', 'init'],
['the-second-child', 'on(init)'],
['the-second-child', 'didReceiveAttrs'],
['the-second-child', 'willRender'],
['the-second-child', 'willInsertElement'],

['the-last-child', 'init'],
['the-last-child', 'on(init)'],
['the-last-child', 'didReceiveAttrs'],
['the-last-child', 'willRender'],
['the-last-child', 'willInsertElement'],
Expand All @@ -618,19 +606,15 @@ class LifeCycleHooksTest extends RenderingTestCase {
// Sync hooks

['the-parent', 'init'],
['the-parent', 'on(init)'],
['the-parent', 'didReceiveAttrs'],

['the-first-child', 'init'],
['the-first-child', 'on(init)'],
['the-first-child', 'didReceiveAttrs'],

['the-second-child', 'init'],
['the-second-child', 'on(init)'],
['the-second-child', 'didReceiveAttrs'],

['the-last-child', 'init'],
['the-last-child', 'on(init)'],
['the-last-child', 'didReceiveAttrs'],
],
});
Expand Down Expand Up @@ -890,19 +874,16 @@ class LifeCycleHooksTest extends RenderingTestCase {
// Sync hooks

['the-top', 'init'],
['the-top', 'on(init)'],
['the-top', 'didReceiveAttrs'],
['the-top', 'willRender'],
['the-top', 'willInsertElement'],

['the-middle', 'init'],
['the-middle', 'on(init)'],
['the-middle', 'didReceiveAttrs'],
['the-middle', 'willRender'],
['the-middle', 'willInsertElement'],

['the-bottom', 'init'],
['the-bottom', 'on(init)'],
['the-bottom', 'didReceiveAttrs'],
['the-bottom', 'willRender'],
['the-bottom', 'willInsertElement'],
Expand All @@ -923,15 +904,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
// Sync hooks

['the-top', 'init'],
['the-top', 'on(init)'],
['the-top', 'didReceiveAttrs'],

['the-middle', 'init'],
['the-middle', 'on(init)'],
['the-middle', 'didReceiveAttrs'],

['the-bottom', 'init'],
['the-bottom', 'on(init)'],
['the-bottom', 'didReceiveAttrs'],
],
});
Expand Down Expand Up @@ -1071,17 +1049,12 @@ class LifeCycleHooksTest extends RenderingTestCase {
let initialHooks = () => {
let ret = [
['an-item', 'init'],
['an-item', 'on(init)'],
['an-item', 'didReceiveAttrs'],
];
if (this.isInteractive) {
ret.push(['an-item', 'willRender'], ['an-item', 'willInsertElement']);
}
ret.push(
['nested-item', 'init'],
['nested-item', 'on(init)'],
['nested-item', 'didReceiveAttrs']
);
ret.push(['nested-item', 'init'], ['nested-item', 'didReceiveAttrs']);
if (this.isInteractive) {
ret.push(['nested-item', 'willRender'], ['nested-item', 'willInsertElement']);
}
Expand Down Expand Up @@ -1177,13 +1150,11 @@ class LifeCycleHooksTest extends RenderingTestCase {
['nested-item', 'willClearRender'],

['no-items', 'init'],
['no-items', 'on(init)'],
['no-items', 'didReceiveAttrs'],
['no-items', 'willRender'],
['no-items', 'willInsertElement'],

['nested-item', 'init'],
['nested-item', 'on(init)'],
['nested-item', 'didReceiveAttrs'],
['nested-item', 'willRender'],
['nested-item', 'willInsertElement'],
Expand Down Expand Up @@ -1218,11 +1189,9 @@ class LifeCycleHooksTest extends RenderingTestCase {

nonInteractive: [
['no-items', 'init'],
['no-items', 'on(init)'],
['no-items', 'didReceiveAttrs'],

['nested-item', 'init'],
['nested-item', 'on(init)'],
['nested-item', 'didReceiveAttrs'],

['an-item', 'willDestroy'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,35 +149,6 @@ moduleFor(
}
}

['@test event listeners are called when event is triggered'](assert) {
let receivedEvent;
let browserEvent;

this.registerComponent('x-button', {
ComponentClass: class extends Component {
tagName = 'button';
init() {
super.init();
Object.keys(SUPPORTED_EMBER_EVENTS).forEach((browserEvent) => {
this.on(SUPPORTED_EMBER_EVENTS[browserEvent], (event) => (receivedEvent = event));
});
}
},
});

this.render(`{{x-button}}`);

let elementNode = this.$('button');
let element = elementNode[0];

for (browserEvent in SUPPORTED_EMBER_EVENTS) {
receivedEvent = null;
runTask(() => triggerEvent(elementNode, browserEvent));
assert.ok(receivedEvent, `${browserEvent} event was triggered`);
assert.strictEqual(receivedEvent.target, element);
}
}

['@test events bubble view hierarchy for form elements'](assert) {
let receivedEvent;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { moduleFor, RenderingTestCase, applyMixins, strip, runTask } from 'internal-test-helpers';

import { notifyPropertyChange, on } from '@ember/-internals/metal';
import { notifyPropertyChange } from '@ember/-internals/metal';
import { get, set, computed } from '@ember/object';
import { A as emberA } from '@ember/array';
import ArrayProxy from '@ember/array/proxy';
Expand Down Expand Up @@ -1116,22 +1116,6 @@ moduleFor(
}
);

moduleFor(
'Syntax test: {{#each}} with array proxies, content is updated after init',
class extends EachTest {
createList(items) {
let wrapped = emberA(items);
let proxy = ArrayProxy.extend({
setup: on('init', function () {
this.set('content', emberA(wrapped));
}),
}).create();

return { list: proxy, delegate: wrapped };
}
}
);

moduleFor(
'Syntax test: {{#each as}} undefined path',
class extends RenderingTestCase {
Expand Down
Loading