Skip to content

Commit dd2cfbf

Browse files
authored
Merge branch 'angular:master' into tabs
2 parents 6f369d5 + a52da04 commit dd2cfbf

File tree

89 files changed

+482
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+482
-494
lines changed

.circleci/config.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ jobs:
472472
- *yarn_install
473473
- *setup_bazel_binary
474474

475-
- run: yarn integration-tests:partial-ivy
476475
- run: yarn integration-tests
477476
- run:
478477
name: Running size integration tests (failures are reported in Slack only).
@@ -482,9 +481,47 @@ jobs:
482481
- *slack_notify_on_failure
483482

484483
# ----------------------------------------------------------------------------
485-
# Job that runs all integration tests against Angular snapshot builds.
484+
# Job that runs the AOT linker tests.
486485
# ----------------------------------------------------------------------------
487-
integration_tests_snapshot:
486+
linker_aot_test:
487+
<<: *job_defaults
488+
resource_class: xlarge
489+
environment:
490+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
491+
steps:
492+
- checkout_and_rebase
493+
- *restore_cache
494+
- *setup_bazel_ci_config
495+
- *setup_bazel_remote_execution
496+
- *yarn_install
497+
- *setup_bazel_binary
498+
499+
- run: yarn test-linker-aot
500+
- *slack_notify_on_failure
501+
502+
# ----------------------------------------------------------------------------
503+
# Job that runs the JIT linker tests.
504+
# ----------------------------------------------------------------------------
505+
linker_jit_test:
506+
<<: *job_defaults
507+
resource_class: xlarge
508+
environment:
509+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
510+
steps:
511+
- checkout_and_rebase
512+
- *restore_cache
513+
- *setup_bazel_ci_config
514+
- *setup_bazel_remote_execution
515+
- *yarn_install
516+
- *setup_bazel_binary
517+
518+
- run: yarn test-linker-jit
519+
- *slack_notify_on_failure
520+
521+
# ----------------------------------------------------------------------------
522+
# Job that runs both AOT and JIT linker tests against Angular snapshot builds.
523+
# ----------------------------------------------------------------------------
524+
snapshot_linker_tests:
488525
<<: *job_defaults
489526
resource_class: xlarge
490527
environment:
@@ -498,7 +535,8 @@ jobs:
498535
- *yarn_install_loose_lockfile
499536
- *setup_bazel_binary
500537

501-
- run: yarn integration-tests:partial-ivy
538+
- run: yarn test-linker-aot
539+
- run: yarn test-linker-jit
502540
- *slack_notify_on_failure
503541

504542
# ----------------------------------------------------------------------------
@@ -544,6 +582,10 @@ workflows:
544582
filters: *ignore_presubmit_branch_filter
545583
- integration_tests:
546584
filters: *ignore_presubmit_branch_filter
585+
- linker_aot_test:
586+
filters: *ignore_presubmit_branch_filter
587+
- linker_jit_test:
588+
filters: *ignore_presubmit_branch_filter
547589
- tests_local_browsers:
548590
filters: *ignore_presubmit_branch_filter
549591
- tests_browserstack:
@@ -578,7 +620,7 @@ workflows:
578620
filters: *only_main_branch_filter
579621
- mdc_snapshot_test_cronjob:
580622
filters: *only_main_branch_filter
581-
- integration_tests_snapshot:
623+
- snapshot_linker_tests:
582624
filters: *only_main_branch_filter
583625

584626
triggers:

integration/linker/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ nodejs_test(
1919
"@npm//glob",
2020
],
2121
entry_point = "link-packages-test.mjs",
22-
tags = ["partial-compilation-integration"],
2322
)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
"approve-api": "node ./scripts/approve-api-golden.js",
4141
"approve-size-tests": "node ./scripts/approve-size-golden.js",
4242
"integration-tests": "bazel test --test_tag_filters=-linker-integration-test --build_tests_only -- //integration/... -//integration/size-test/...",
43-
"integration-tests:partial-ivy": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
4443
"integration-tests:size-test": "bazel test //integration/size-test/...",
44+
"test-linker-aot": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
45+
"test-linker-jit": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only --//tools:force_partial_jit_compilation=True -- //integration/... //src/...",
4546
"check-mdc-tests": "ts-node --project scripts/tsconfig.json scripts/check-mdc-tests.ts",
4647
"check-mdc-exports": "ts-node --project scripts/tsconfig.json scripts/check-mdc-exports.ts",
4748
"check-tooling-setup": "yarn tsc --project tools/tsconfig.json && yarn tsc --project .ng-dev/tsconfig.json",

src/cdk-experimental/column-resize/resizable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export abstract class Resizable<HandleComponent extends ResizeOverlayHandle>
6767
protected abstract readonly changeDetectorRef: ChangeDetectorRef;
6868

6969
private _viewInitialized = false;
70+
private _isDestroyed = false;
7071

7172
/** The minimum width to allow the column to be sized to. */
7273
get minWidthPx(): number {
@@ -100,13 +101,15 @@ export abstract class Resizable<HandleComponent extends ResizeOverlayHandle>
100101
this._appendInlineHandle();
101102

102103
this.styleScheduler.scheduleEnd(() => {
104+
if (this._isDestroyed) return;
103105
this._viewInitialized = true;
104106
this._applyMinWidthPx();
105107
this._applyMaxWidthPx();
106108
});
107109
}
108110

109111
ngOnDestroy(): void {
112+
this._isDestroyed = true;
110113
this.destroyed.next();
111114
this.destroyed.complete();
112115
this.inlineHandle?.remove();

src/cdk-experimental/dialog/dialog.spec.ts

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Directive,
1414
Inject,
1515
Injector,
16-
NgModule,
1716
TemplateRef,
1817
ViewChild,
1918
ViewContainerRef,
@@ -45,7 +44,16 @@ describe('Dialog', () => {
4544

4645
beforeEach(fakeAsync(() => {
4746
TestBed.configureTestingModule({
48-
imports: [DialogModule, DialogTestModule],
47+
imports: [DialogModule, NoopAnimationsModule],
48+
declarations: [
49+
ComponentWithChildViewContainer,
50+
ComponentWithTemplateRef,
51+
PizzaMsg,
52+
ContentElementDialog,
53+
DialogWithInjectedData,
54+
DialogWithoutFocusableElements,
55+
DirectiveWithViewContainer,
56+
],
4957
providers: [{provide: Location, useClass: SpyLocation}],
5058
});
5159

@@ -1138,7 +1146,7 @@ describe('Dialog with a parent Dialog', () => {
11381146

11391147
beforeEach(fakeAsync(() => {
11401148
TestBed.configureTestingModule({
1141-
imports: [DialogModule, DialogTestModule],
1149+
imports: [DialogModule, NoopAnimationsModule],
11421150
declarations: [ComponentThatProvidesMatDialog],
11431151
providers: [
11441152
{
@@ -1315,32 +1323,3 @@ class DialogWithoutFocusableElements {}
13151323
encapsulation: ViewEncapsulation.ShadowDom,
13161324
})
13171325
class ShadowDomComponent {}
1318-
1319-
// Create a real (non-test) NgModule as a workaround for
1320-
// https://github.com/angular/angular/issues/10760
1321-
const TEST_DIRECTIVES = [
1322-
ComponentWithChildViewContainer,
1323-
ComponentWithTemplateRef,
1324-
PizzaMsg,
1325-
DirectiveWithViewContainer,
1326-
ComponentWithOnPushViewContainer,
1327-
ContentElementDialog,
1328-
DialogWithInjectedData,
1329-
DialogWithoutFocusableElements,
1330-
ShadowDomComponent,
1331-
];
1332-
1333-
@NgModule({
1334-
imports: [DialogModule, NoopAnimationsModule],
1335-
exports: TEST_DIRECTIVES,
1336-
declarations: TEST_DIRECTIVES,
1337-
entryComponents: [
1338-
ComponentWithChildViewContainer,
1339-
ComponentWithTemplateRef,
1340-
PizzaMsg,
1341-
ContentElementDialog,
1342-
DialogWithInjectedData,
1343-
DialogWithoutFocusableElements,
1344-
],
1345-
})
1346-
class DialogTestModule {}

src/cdk/drag-drop/directives/drag.spec.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5972,6 +5972,63 @@ describe('CdkDrag', () => {
59725972
}),
59735973
);
59745974

5975+
it('should return the last item to initial position when dragging back into a container with disabled sorting', fakeAsync(() => {
5976+
const fixture = createComponent(ConnectedDropZones);
5977+
fixture.detectChanges();
5978+
5979+
const groups = fixture.componentInstance.groupedDragItems;
5980+
const dropZones = fixture.componentInstance.dropInstances.map(d => d.element.nativeElement);
5981+
const lastIndex = groups[0].length - 1;
5982+
const lastItem = groups[0][lastIndex];
5983+
const targetRect = groups[1][2].element.nativeElement.getBoundingClientRect();
5984+
5985+
fixture.componentInstance.dropInstances.first.sortingDisabled = true;
5986+
startDraggingViaMouse(fixture, lastItem.element.nativeElement);
5987+
5988+
const placeholder = dropZones[0].querySelector('.cdk-drag-placeholder')!;
5989+
5990+
expect(placeholder).toBeTruthy();
5991+
expect(dropZones[0].contains(placeholder))
5992+
.withContext('Expected placeholder to be inside the first container.')
5993+
.toBe(true);
5994+
expect(getElementIndexByPosition(placeholder, 'top'))
5995+
.withContext('Expected placeholder to be at item index.')
5996+
.toBe(lastIndex);
5997+
5998+
dispatchMouseEvent(document, 'mousemove', targetRect.left + 1, targetRect.top + 1);
5999+
fixture.detectChanges();
6000+
6001+
expect(dropZones[1].contains(placeholder))
6002+
.withContext('Expected placeholder to be inside second container.')
6003+
.toBe(true);
6004+
expect(getElementIndexByPosition(placeholder, 'top'))
6005+
.withContext('Expected placeholder to be at the target index.')
6006+
.toBe(3);
6007+
6008+
const firstInitialSiblingRect = groups[0][0].element.nativeElement.getBoundingClientRect();
6009+
6010+
// Return the item to an index that is different from the initial one.
6011+
dispatchMouseEvent(
6012+
document,
6013+
'mousemove',
6014+
firstInitialSiblingRect.left,
6015+
firstInitialSiblingRect.top,
6016+
);
6017+
fixture.detectChanges();
6018+
6019+
expect(dropZones[0].contains(placeholder))
6020+
.withContext('Expected placeholder to be back inside first container.')
6021+
.toBe(true);
6022+
expect(getElementIndexByPosition(placeholder, 'top'))
6023+
.withContext('Expected placeholder to be back at the initial index.')
6024+
.toBe(lastIndex);
6025+
6026+
dispatchMouseEvent(document, 'mouseup');
6027+
fixture.detectChanges();
6028+
6029+
expect(fixture.componentInstance.droppedSpy).not.toHaveBeenCalled();
6030+
}));
6031+
59756032
it(
59766033
'should toggle a class when dragging an item inside a wrapper component component ' +
59776034
'with OnPush change detection',

src/cdk/drag-drop/drop-list-ref.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ export class DropListRef<T = any> {
299299
newPositionReference = activeDraggables[newIndex + 1];
300300
}
301301

302+
// If we didn't find a new position reference, it means that either the item didn't start off
303+
// in this container, or that the item requested to be inserted at the end of the list.
304+
if (
305+
!newPositionReference &&
306+
(newIndex == null || newIndex === -1 || newIndex < activeDraggables.length - 1) &&
307+
this._shouldEnterAsFirstChild(pointerX, pointerY)
308+
) {
309+
newPositionReference = activeDraggables[0];
310+
}
311+
302312
// Since the item may be in the `activeDraggables` already (e.g. if the user dragged it
303313
// into another container and back again), we have to ensure that it isn't duplicated.
304314
if (currentIndex > -1) {
@@ -311,10 +321,6 @@ export class DropListRef<T = any> {
311321
const element = newPositionReference.getRootElement();
312322
element.parentElement!.insertBefore(placeholder, element);
313323
activeDraggables.splice(newIndex, 0, item);
314-
} else if (this._shouldEnterAsFirstChild(pointerX, pointerY)) {
315-
const reference = activeDraggables[0].getRootElement();
316-
reference.parentNode!.insertBefore(placeholder, reference);
317-
activeDraggables.unshift(item);
318324
} else {
319325
coerceElement(this.element).appendChild(placeholder);
320326
activeDraggables.push(item);

src/cdk/overlay/dispatchers/overlay-keyboard-dispatcher.spec.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {TestBed, inject} from '@angular/core/testing';
22
import {dispatchKeyboardEvent} from '../../testing/private';
33
import {ESCAPE} from '@angular/cdk/keycodes';
4-
import {Component, NgModule} from '@angular/core';
4+
import {Component} from '@angular/core';
55
import {OverlayModule, Overlay} from '../index';
66
import {OverlayKeyboardDispatcher} from './overlay-keyboard-dispatcher';
77
import {ComponentPortal} from '@angular/cdk/portal';
@@ -12,7 +12,8 @@ describe('OverlayKeyboardDispatcher', () => {
1212

1313
beforeEach(() => {
1414
TestBed.configureTestingModule({
15-
imports: [OverlayModule, TestComponentModule],
15+
imports: [OverlayModule],
16+
declarations: [TestComponent],
1617
});
1718

1819
inject([OverlayKeyboardDispatcher, Overlay], (kbd: OverlayKeyboardDispatcher, o: Overlay) => {
@@ -184,12 +185,3 @@ describe('OverlayKeyboardDispatcher', () => {
184185
template: 'Hello',
185186
})
186187
class TestComponent {}
187-
188-
// Create a real (non-test) NgModule as a workaround for
189-
// https://github.com/angular/angular/issues/10760
190-
@NgModule({
191-
exports: [TestComponent],
192-
declarations: [TestComponent],
193-
entryComponents: [TestComponent],
194-
})
195-
class TestComponentModule {}

0 commit comments

Comments
 (0)