diff --git a/cypress/integration/Map-spec.js b/cypress/integration/Map-spec.js index 7f29c5d..83c8855 100644 --- a/cypress/integration/Map-spec.js +++ b/cypress/integration/Map-spec.js @@ -65,4 +65,16 @@ describe('Map', () => { cy.contains('TRAVEL').click() // ! Assert that the new planet is traveled to }) + + it("Should hide all 'g' components after traveling to the chosen planet.", () => { + const destinationPlanet = mockState.world.planets.find( + planet => planet.name !== mockState.ship.location.name + ) + cy.contains(destinationPlanet.name).click() + cy.get('#travel-button').click() + cy.wait(1000) + cy.get('#map-root > svg') + .children() + .should('have.length', 0) + }) }) diff --git a/src/components/TravelPrompt.js b/src/components/TravelPrompt.js index 50572b9..e211386 100644 --- a/src/components/TravelPrompt.js +++ b/src/components/TravelPrompt.js @@ -10,6 +10,7 @@ import { } from '@material-ui/core' import { connect } from 'react-redux' import { instantTravel } from '../redux/actions/ship' +import { hidePlanets } from '../util/map' const TravelPrompt = ({ destination, handleTravel, open, setOpen }) => { const handleClose = () => setOpen(false) @@ -27,6 +28,7 @@ const TravelPrompt = ({ destination, handleTravel, open, setOpen }) => { Cancel