2021-12-10 02:37:01 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
2024-09-20 15:23:15 +00:00
|
|
|
* found in the LICENSE file at https://angular.dev/license
|
2021-12-10 02:37:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2020-02-24 19:05:48 +00:00
|
|
|
describe('edit properties of directive in the property view tab', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.visit('/');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('edit app-todo component', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
// select todo node in component tree
|
2021-12-09 05:44:17 +00:00
|
|
|
cy.get('.tree-wrapper')
|
2025-06-15 23:10:52 +00:00
|
|
|
.find('ng-tree-node:contains("app-todo[TooltipDirective]")')
|
2021-12-09 05:44:17 +00:00
|
|
|
.first()
|
|
|
|
|
.click({force: true});
|
2020-02-24 19:05:48 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should be able to enable editMode', () => {
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
2020-04-08 23:22:14 +00:00
|
|
|
getBody().find('app-todo input.edit').should('not.be.visible');
|
2020-02-24 19:05:48 +00:00
|
|
|
});
|
|
|
|
|
|
2021-04-14 18:52:26 +00:00
|
|
|
cy.get('.explorer-panel:contains("app-todo")')
|
2021-12-09 05:44:17 +00:00
|
|
|
.find('ng-property-view mat-tree-node:contains("editMode")')
|
2025-10-10 15:22:26 +00:00
|
|
|
.find('ng-property-editor')
|
2021-12-09 05:44:17 +00:00
|
|
|
.click({force: true})
|
2025-10-10 15:22:26 +00:00
|
|
|
.find('input')
|
2021-12-09 05:44:17 +00:00
|
|
|
.clear()
|
|
|
|
|
.type('true')
|
|
|
|
|
.type('{enter}');
|
2020-02-24 19:05:48 +00:00
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
2020-04-08 23:22:14 +00:00
|
|
|
getBody().find('app-todo input.edit').should('be.visible');
|
2020-02-24 19:05:48 +00:00
|
|
|
});
|
|
|
|
|
});
|
2025-06-15 23:10:52 +00:00
|
|
|
});
|
2020-02-24 19:05:48 +00:00
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
describe('edit title property', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.get('.tree-wrapper')
|
|
|
|
|
.find('ng-tree-node:contains("app-todos")')
|
|
|
|
|
.first()
|
|
|
|
|
.click({force: true});
|
|
|
|
|
});
|
2025-06-24 15:00:43 +00:00
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
it('should change title in app when edited', () => {
|
|
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
|
|
|
|
getBody().find('#demo-app-title').contains('Angular Todo');
|
2020-02-24 19:05:48 +00:00
|
|
|
});
|
|
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
// find title variable and run through edit logic
|
|
|
|
|
cy.get('.explorer-panel:contains("app-todos")')
|
|
|
|
|
.find('ng-property-view mat-tree-node:contains("title")')
|
2025-10-10 15:22:26 +00:00
|
|
|
.find('ng-property-editor')
|
2025-06-15 23:10:52 +00:00
|
|
|
.click()
|
2025-10-10 15:22:26 +00:00
|
|
|
.find('input')
|
2025-06-15 23:10:52 +00:00
|
|
|
.clear()
|
|
|
|
|
.type('Hello World')
|
|
|
|
|
.type('{enter}');
|
2020-02-24 19:05:48 +00:00
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
// assert that the page has been updated
|
|
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
|
|
|
|
getBody().find('#demo-app-title').contains('Hello World');
|
2020-02-24 19:05:48 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|