Skip to content

Commit

Permalink
chore(Observable Lifecycle): Add test to verify oneof restoration cap…
Browse files Browse the repository at this point in the history
…ability
  • Loading branch information
zakhenry committed Oct 22, 2020
1 parent 11dfaa8 commit a583d26
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/ngx-sub-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^9.0.0",
"@angular/core": "^9.0.0"
"@angular/common": "^10.0.0",
"@angular/core": "^10.0.0"
},
"keywords": [
"Angular",
Expand Down
34 changes: 34 additions & 0 deletions src/app/app.spec.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,40 @@ context(`EJawa demo`, () => {
});
});

it(`should be able to go from a spaceship to a speeder AND back and restore the original value`, () => {
DOM.list.elements.cy.eq(0).click();
DOM.list.elements.cy.eq(1).click();
DOM.list.elements.cy.eq(0).click();

const x = hardCodedListings[0] as VehicleListing;
const s = x.product as Spaceship;

const expectedObj: FormElement = {
title: x.title,
price: '£' + x.price.toLocaleString(),
inputs: {
id: x.id,
title: x.title,
imageUrl: x.imageUrl,
price: x.price + '',
listingType: x.listingType,
vehicleForm: {
vehicleType: x.product.vehicleType,
spaceshipForm: {
color: s.color,
canFire: s.canFire,
crewMembers: s.crewMembers,
wingCount: s.wingCount,
},
},
},
};

DOM.form.cy.should($el => {
expect(getFormValue($el, VehicleType.SPACESHIP)).to.eql(expectedObj);
});
});

it(`should display the (nested) errors from the form`, () => {
DOM.createNewButton.click();

Expand Down

0 comments on commit a583d26

Please sign in to comment.