mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(devtools): pass property updates to the correct data sources
This commit is contained in:
parent
3a6b5b0bd9
commit
820ec85ea4
2 changed files with 26 additions and 3 deletions
|
|
@ -22,7 +22,7 @@ describe('edit properties of directive in the property view tab', () => {
|
|||
cy.get('.explorer-panel:contains("Properties of app-todo")')
|
||||
.find('ng-property-view mat-tree-node:contains("editMode")')
|
||||
.find('ng-property-editor .editor')
|
||||
.click()
|
||||
.click({ force: true })
|
||||
.find('.editor-input')
|
||||
.clear()
|
||||
.type('true')
|
||||
|
|
|
|||
|
|
@ -91,11 +91,34 @@ export class DirectivePropertyResolver {
|
|||
}
|
||||
|
||||
getExpandedProperties(): NestedProp[] {
|
||||
return getExpandedDirectiveProperties(this._dataSource.data);
|
||||
return [
|
||||
...getExpandedDirectiveProperties(this._inputsDataSource.data),
|
||||
...getExpandedDirectiveProperties(this._outputsDataSource.data),
|
||||
...getExpandedDirectiveProperties(this._stateDataSource.data),
|
||||
];
|
||||
}
|
||||
|
||||
updateProperties(newProps: Properties): void {
|
||||
this._dataSource.update(newProps.props);
|
||||
const inputLabels: string[] = Object.keys(newProps.inputs || {});
|
||||
const outputLabels: string[] = Object.keys(newProps.outputs || {});
|
||||
|
||||
const inputProps = {};
|
||||
const outputProps = {};
|
||||
const stateProps = {};
|
||||
let propPointer;
|
||||
|
||||
Object.keys(this.directiveProperties).forEach(propName => {
|
||||
propPointer = inputLabels.includes(propName)
|
||||
? inputProps
|
||||
: outputLabels.includes(propName)
|
||||
? outputProps
|
||||
: stateProps;
|
||||
propPointer[propName] = this.directiveProperties[propName];
|
||||
});
|
||||
|
||||
this._inputsDataSource.update(inputProps);
|
||||
this._outputsDataSource.update(outputProps);
|
||||
this._stateDataSource.update(stateProps);
|
||||
this._props = newProps;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue