-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic passing acceptance test for US-1 #31
- Loading branch information
1 parent
7126cce
commit 07e0680
Showing
8 changed files
with
6,320 additions
and
26 deletions.
There are no files selected for viewing
6,202 changes: 6,202 additions & 0 deletions
6,202
__tests__/__snapshots__/building-highlights.test.js.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { reloadApp } = require("detox-expo-helpers"); | ||
import { BuildingId } from "../src/types/main"; | ||
import { Buildings } from "../src/constants/buildings.data"; | ||
|
||
beforeAll(async () => { | ||
await reloadApp(); | ||
}); | ||
|
||
describe("CampusToggle: Toggling between campuses", () => { | ||
it("should show the campus toggles", async () => { | ||
await expect(element(by.id("SGWButton"))).toBeVisible(); | ||
await expect(element(by.id("loyolaButton"))).toBeVisible(); | ||
}); | ||
|
||
it("should show the Loyola campus on Loyola toggle press", async () => { | ||
await element(by.id("loyolaButton")).tap(); | ||
await expect(element(by.id("polygon" + BuildingId[BuildingId.VL]))).toExist(); | ||
await expect(element(by.id("marker" + BuildingId[BuildingId.VL]))).toExist(); | ||
}); | ||
|
||
it("should show the SGW campus on SGW toggle press", async () => { | ||
await element(by.id("SGWButton")).tap(); | ||
await expect(element(by.id("polygon" + BuildingId[BuildingId.H]))).toExist(); | ||
await expect(element(by.id("marker" + BuildingId[BuildingId.H]))).toExist(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/components/building-highlights/building-highlights.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { Polygon, Marker } from "react-native-maps"; | ||
import { Buildings } from "../../constants/buildings.data"; | ||
import { BuildingId } from "../../types/main"; | ||
import { View, Text, StyleSheet } from "react-native"; | ||
import { CONCORDIA_RED, BUILDING_UNTAPPED } from "../../constants/style"; | ||
|
||
interface IProps { | ||
onBuildingTap: (id: BuildingId) => void; | ||
tappedBuilding: BuildingId; | ||
} | ||
|
||
/** | ||
* Wrapper Component for Polygons and Markers which overlay campus buildings. | ||
*/ | ||
const BuildingHighlights = ({ onBuildingTap, tappedBuilding }: IProps) => { | ||
/** | ||
* Fill color for the Polygons | ||
*/ | ||
const [fillColor, setFillColor] = useState<string>(null); | ||
const [tappedColor, setTappedColor] = useState<string>(null); | ||
useEffect(() => { | ||
setFillColor(BUILDING_UNTAPPED); | ||
setTappedColor(CONCORDIA_RED); | ||
}, []); | ||
|
||
return ( | ||
<View> | ||
{Buildings.map(building => ( | ||
<View key={building.id}> | ||
{building.boundingBox.length > 0 ? ( | ||
<Polygon | ||
testID={"polygon" + BuildingId[building.id]} | ||
coordinates={building.boundingBox} | ||
tappable={true} | ||
fillColor={ | ||
tappedBuilding != null && tappedBuilding === building.id | ||
? tappedColor | ||
: fillColor | ||
} | ||
onPress={() => { | ||
onBuildingTap(building.id); | ||
}} | ||
/> | ||
) : null} | ||
|
||
<Marker | ||
testID={"marker" + BuildingId[building.id]} | ||
coordinate={building.location} | ||
onPress={() => { | ||
onBuildingTap(building.id); | ||
}} | ||
tracksViewChanges={false} | ||
tracksInfoWindowChanges={false} | ||
> | ||
<Text style={styles.marker}>{BuildingId[building.id]}</Text> | ||
</Marker> | ||
</View> | ||
))} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
marker: { | ||
backgroundColor: "#252525", | ||
color: "#f0f0f0", | ||
padding: 1, | ||
borderRadius: 5 | ||
} | ||
}); | ||
|
||
export default BuildingHighlights; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters