angular/packages/zone.js/test
JiaLiPassion 08b0c87a94 fix(zone.js): Promise.resolve(subPromise) should return subPromise (#53423)
In the original `Promise` impelmentation, zone.js follow the spec from
https://promisesaplus.com/#point-51.

```
const p1 = Promise.resolve(1);
const p2 = Promise.resolve(p1);

p1 === p2; // false
```
in this case, `p2` should be the same status with `p1` but they are
still different instances.

And for some edge case.

```
class MyPromise extends Promise {
  constructor(sub) {
    super((res) => res(null));
    this.sub = sub;
  }
  then(onFufilled, onRejected) {
    this.sub.then(onFufilled, onRejected);
  }
}

const p1 = new Promise(setTimeout(res), 100);
const myP = new MyPromise(p1);
const r = await myP;
r === 1; // false
```

So in the above code, `myP` is not the same instance with `p1`,
and since `myP` is resolved in constructor, so `await myP` will
just pass without waiting for `p1`.

And in the current `tc39` spec here https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise-resolve
`Promise.resolve(subP)` should return `subP`.

```
const p1 = Promise.resolve(1);
const p2 = Promise.resolve(p1);

p1 === p2; // true
```

So the above `MyPromise` can wait for the `p1` correctly.

PR Close #53423
2023-12-11 10:55:12 -08:00
..
assets refactor(zone.js): remove onProp eventNames array to reduce the bundle size (#40962) 2022-03-01 18:41:15 +00:00
browser build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
closure refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
common fix(zone.js): Promise.resolve(subPromise) should return subPromise (#53423) 2023-12-11 10:55:12 -08:00
extra test(zone.js): update zone.js test for jasmine upgrade (#49914) 2023-05-09 14:38:45 -07:00
jest fix(zone.js): add conditional exports to zone.js package (#51652) 2023-09-06 16:37:26 +00:00
node test(zone.js): update zone.js test for jasmine upgrade (#49914) 2023-05-09 14:38:45 -07:00
npm_package feat(zone.js): remove legacy files and access to deep imports (#51752) 2023-09-14 12:11:05 +02:00
patch build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
performance build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
promise fix(zone.js): Promise.resolve(subPromise) should return subPromise (#53423) 2023-12-11 10:55:12 -08:00
rxjs fix(zone.js): zone patch rxjs should return null _unsubscribe correctly. (#37091) 2020-07-27 12:10:27 -07:00
typings build: update cross-repo angular dependencies (#52191) 2023-10-26 14:12:34 -07:00
webdriver build: remove core-js-bundle from dependencies (#49259) 2023-03-01 11:19:48 -08:00
zone-spec test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
browser-env-setup.ts build: move zone.js to angular repo (#30962) 2019-06-20 11:27:39 -07:00
browser-zone-setup.ts fix(zone.js): disable wrapping unhandled promise error by default (#52492) 2023-11-03 09:33:20 -07:00
browser_disable_wrap_uncaught_promise_rejection_entry_point.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
browser_disable_wrap_uncaught_promise_rejection_setup.ts fix(zone.js): disable wrapping unhandled promise error by default (#52492) 2023-11-03 09:33:20 -07:00
browser_entry_point.ts fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50530) 2023-06-07 12:42:33 -07:00
browser_es2015_entry_point.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
browser_shadydom_entry_point.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
browser_shadydom_setup.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
browser_symbol_setup.ts fix(zone.js): disable wrapping unhandled promise error by default (#52492) 2023-11-03 09:33:20 -07:00
BUILD.bazel feat(zone.js): remove legacy files and access to deep imports (#51752) 2023-09-14 12:11:05 +02:00
common_tests.ts fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50530) 2023-06-07 12:42:33 -07:00
fake_entry.js build: move zone.js to angular repo (#30962) 2019-06-20 11:27:39 -07:00
jasmine-patch.spec.ts feat(zone.js): include jasmine describe block name when raising unexpected task error 2022-07-18 19:19:00 +02:00
karma_test.bzl feat(zone.js): remove legacy files and access to deep imports (#51752) 2023-09-14 12:11:05 +02:00
main.ts build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
mocha-patch.spec.ts fix(zone.js): revert Mocha it.skip, describe.skip method patch (#49329) 2023-03-14 09:13:57 -07:00
node-env-setup.ts fix(zone.js): disable wrapping unhandled promise error by default (#52492) 2023-11-03 09:33:20 -07:00
node_bluebird_entry_point.init.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_entry_point.init.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_error_disable_policy.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_error_disable_policy_entry_point.init.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_error_entry_point.init.ts Revert "fix(zone.js): enable monkey patching of the queueMicrotask() API in node.js (#50467)" (#50529) 2023-05-31 09:57:42 -07:00
node_error_lazy_policy.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_error_lazy_policy_entry_point.init.ts refactor: update zone.js and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
node_tests.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
saucelabs.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test-env-setup-jasmine.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test-env-setup-mocha.ts fix(zone.js): use globalThis instead of global and window (#52367) 2023-10-25 09:31:17 -07:00
test-util.ts build: update to jasmine 4.0 (#45558) 2022-04-11 16:25:28 +00:00
test_fake_polyfill.ts fix(zone.js): use globalThis instead of global and window (#52367) 2023-10-25 09:31:17 -07:00
ws-client.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ws-server.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ws-webworker-context.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
wtf_mock.ts fix(zone.js): use globalThis instead of global and window (#52367) 2023-10-25 09:31:17 -07:00
zone_worker_entry_point.ts fix(zone.js): use globalThis instead of global and window (#52367) 2023-10-25 09:31:17 -07:00