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-07 14:42:00 +00:00
|
|
|
describe('Tracking items from application to component tree', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.visit('/');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have only one todo item on start', () => {
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
2020-03-26 22:57:01 +00:00
|
|
|
getBody().find('app-todo').contains('Buy milk');
|
2020-02-07 14:42:00 +00:00
|
|
|
});
|
|
|
|
|
|
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
|
|
|
.its('length')
|
|
|
|
|
.should('eq', 2);
|
2020-02-07 14:42:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should be able to detect a new todo from user and add it to the tree', () => {
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.enterIframe('#sample-app')
|
2021-12-09 05:44:17 +00:00
|
|
|
.then((getBody) => {
|
|
|
|
|
getBody().find('input.new-todo').type('Buy cookies{enter}');
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.enterIframe('#sample-app').then((getBody) => {
|
2021-12-09 05:44:17 +00:00
|
|
|
getBody().find('app-todo').contains('Buy milk');
|
2020-02-07 14:42:00 +00:00
|
|
|
|
2021-12-09 05:44:17 +00:00
|
|
|
getBody().find('app-todo').contains('Build something fun!');
|
2020-03-29 03:29:52 +00:00
|
|
|
|
2021-12-09 05:44:17 +00:00
|
|
|
getBody().find('app-todo').contains('Buy cookies');
|
2020-03-29 03:29:52 +00:00
|
|
|
});
|
2024-01-16 21:35:47 +00:00
|
|
|
});
|
2020-03-29 03:29:52 +00:00
|
|
|
|
2025-06-15 23:10:52 +00:00
|
|
|
cy.get('.tree-wrapper ng-tree-node:contains("app-todo[TooltipDirective]")').should(
|
2021-12-09 05:44:17 +00:00
|
|
|
'have.length',
|
|
|
|
|
3,
|
|
|
|
|
);
|
2020-02-07 14:42:00 +00:00
|
|
|
});
|
|
|
|
|
});
|