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

[doc beta] fixing references to Ember in the subdirectory ember #16164

Merged
merged 1 commit into from
Jan 30, 2018
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
6 changes: 4 additions & 2 deletions packages/ember/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ Object.defineProperty(Ember, 'LOG_BINDINGS', {
and reporting code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 390 refers to Ember.String.loc. Those types of refernces are what we are looking to update to String.loc


```javascript
import $ from 'jquery';

Ember.onerror = function(error) {
Em.$.ajax('/report-error', 'POST', {
$.ajax('/report-error', 'POST', {
stack: error.stack,
otherInformation: 'whatever app state you want to provide'
});
Expand Down Expand Up @@ -385,7 +387,7 @@ computed.collect = collect;

/**
Defines the hash of localized strings for the current language. Used by
the `Ember.String.loc()` helper. To localize, add string values to this
the `String.loc` helper. To localize, add string values to this
hash.

@property STRINGS
Expand Down
49 changes: 25 additions & 24 deletions packages/ember/tests/error_handler_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import { run } from 'ember-metal';
import { DEBUG } from 'ember-env-flags';
import RSVP from 'rsvp';

const ONERROR = Ember.onerror;
const ADAPTER = Ember.Test && Ember.Test.adapter;
Expand Down Expand Up @@ -61,7 +62,7 @@ QUnit.test('when Ember.onerror (which does not rethrow) is registered - sync run
});

if (DEBUG) {
QUnit.test('when Ember.Test.adapter is registered and error is thrown - sync run', function(assert) {
QUnit.test('when TestAdapter is registered and error is thrown - sync run', function(assert) {
assert.expect(1);

Ember.Test.adapter = {
Expand All @@ -73,7 +74,7 @@ if (DEBUG) {
assert.throws(runThatThrowsSync, Error);
});

QUnit.test('when both Ember.onerror (which rethrows) and Ember.Test.adapter are registered - sync run', function(assert) {
QUnit.test('when both Ember.onerror (which rethrows) and TestAdapter are registered - sync run', function(assert) {
assert.expect(2);

Ember.Test.adapter = {
Expand All @@ -83,14 +84,14 @@ if (DEBUG) {
};

Ember.onerror = function(error) {
assert.ok(true, 'onerror is called for sync errors even if Ember.Test.adapter is setup');
assert.ok(true, 'onerror is called for sync errors even if TestAdapter is setup');
throw error;
};

assert.throws(runThatThrowsSync, Error, 'error is thrown');
});

QUnit.test('when both Ember.onerror (which does not rethrow) and Ember.Test.adapter are registered - sync run', function(assert) {
QUnit.test('when both Ember.onerror (which does not rethrow) and TestAdapter are registered - sync run', function(assert) {
assert.expect(2);

Ember.Test.adapter = {
Expand All @@ -100,14 +101,14 @@ if (DEBUG) {
};

Ember.onerror = function() {
assert.ok(true, 'onerror is called for sync errors even if Ember.Test.adapter is setup');
assert.ok(true, 'onerror is called for sync errors even if TestAdapter is setup');
};

runThatThrowsSync();
assert.ok(true, 'no error was thrown, Ember.onerror can intercept errors');
});

QUnit.test('when Ember.Test.adapter is registered and error is thrown - async run', function(assert) {
QUnit.test('when TestAdapter is registered and error is thrown - async run', function(assert) {
assert.expect(3);
let done = assert.async();

Expand Down Expand Up @@ -145,7 +146,7 @@ if (DEBUG) {
}, 20);
});

QUnit.test('when both Ember.onerror and Ember.Test.adapter are registered - async run', function(assert) {
QUnit.test('when both Ember.onerror and TestAdapter are registered - async run', function(assert) {
assert.expect(1);
let done = assert.async();

Expand Down Expand Up @@ -313,7 +314,7 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when Ember.onerror which does rethrow is present - rsvp`, function(assert) {
Expand Down Expand Up @@ -341,7 +342,7 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when Ember.onerror which does not rethrow is present (Ember.testing = false) - rsvp`, function(assert) {
Expand All @@ -357,7 +358,7 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when Ember.onerror which does rethrow is present (Ember.testing = false) - rsvp`, function(assert) {
Expand Down Expand Up @@ -386,11 +387,11 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

if (DEBUG) {
QUnit.test(`${message} when Ember.Test.adapter without \`exception\` method is present - rsvp`, function(assert) {
QUnit.test(`${message} when TestAdapter without \`exception\` method is present - rsvp`, function(assert) {
assert.expect(1);

let thrown = new Error('the error');
Expand All @@ -414,10 +415,10 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when both Ember.onerror and Ember.Test.adapter without \`exception\` method are present - rsvp`, function(assert) {
QUnit.test(`${message} when both Ember.onerror and TestAdapter without \`exception\` method are present - rsvp`, function(assert) {
assert.expect(1);

let thrown = new Error('the error');
Expand All @@ -438,10 +439,10 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when Ember.Test.adapter is present - rsvp`, function(assert) {
QUnit.test(`${message} when TestAdapter is present - rsvp`, function(assert) {
assert.expect(1);

let thrown = new Error('the error');
Expand All @@ -455,10 +456,10 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when both Ember.onerror and Ember.Test.adapter are present - rsvp`, function(assert) {
QUnit.test(`${message} when both Ember.onerror and TestAdapter are present - rsvp`, function(assert) {
assert.expect(1);

let thrown = new Error('the error');
Expand All @@ -476,10 +477,10 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});

QUnit.test(`${message} when both Ember.onerror and Ember.Test.adapter are present - rsvp`, function(assert) {
QUnit.test(`${message} when both Ember.onerror and TestAdapter are present - rsvp`, function(assert) {
assert.expect(2);

let thrown = new Error('the error');
Expand All @@ -498,25 +499,25 @@ function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)

// RSVP.Promise's are configured to settle within the run loop, this
// ensures that run loop has completed
return new Ember.RSVP.Promise((resolve) => setTimeout(resolve, timeout));
return new RSVP.Promise((resolve) => setTimeout(resolve, timeout));
});
}
}

generateRSVPErrorHandlingTests('errors in promise constructor', (error) => {
new Ember.RSVP.Promise(() => {
new RSVP.Promise(() => {
throw error;
});
});

generateRSVPErrorHandlingTests('errors in promise .then callback', (error) => {
Ember.RSVP.resolve().then(() => {
RSVP.resolve().then(() => {
throw error;
});
});

generateRSVPErrorHandlingTests('errors in async promise .then callback', (error) => {
new Ember.RSVP.Promise((resolve) => setTimeout(resolve, 10)).then(() => {
new RSVP.Promise((resolve) => setTimeout(resolve, 10)).then(() => {
throw error;
});
}, 20);