Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 3x 9x 9x 9x 9x 9x 9x 9x 4x 2x 2x 5x 3x 79x 79x 10x 3x 7x | import React from "react"; import { Card, Button, Container, Row, Col } from "react-bootstrap"; const curr = new Date(); function isFutureDate(startingDate) { const startYear = parseInt(startingDate); const startMonth = parseInt(startingDate.substring(5,7)); const startDate = parseInt(startingDate.substring(8,10)); const currYear = curr.getFullYear(); const currMonth = curr.getMonth() + 1; const currDate = curr.getDate(); if (startYear === currYear) { if (startMonth === currMonth) { return startDate > currDate; } else { // Stryker disable next-line all: mutation test unreasonable return startMonth > currMonth; } } else { // Stryker disable next-line all: mutation test unreasonable return startYear > currYear; } } const CommonsCard = ({ buttonText, buttonLink, commons ,color}) => { const testIdPrefix = "commonsCard"; return ( <Card.Body style={ // Stryker disable next-line all : don't mutation test CSS { fontSize: "20px", borderTop: "1px solid lightgrey",backgroundColor: color ,boxShadow: "0px 4px 8px rgba(0, 0, 0, 0.1)"} }> <Container> <Row> <Col sx={4} data-testid={`${testIdPrefix}-name-${commons.id}` }style={ // Stryker disable next-line all: don't test CSS params { fontSize: "20px", fontWeight: "bold",fontFamily:'fantasy'} } >{commons.name}</Col> {buttonText != null && <Col sm={4}> <Button data-testid={`${testIdPrefix}-button-${buttonText}-${commons.id}`} size="sm" className="mx-4" style={ // Stryker disable next-line all: don't test CSS params { fontWeight: "bold",fontFamily:'fantasy'} } onClick={() => { if (buttonText === "Join" && isFutureDate(commons.startingDate)) { // Stryker disable next-line all: unable to read alert text in tests alert("This commons has not started yet and cannot be joined.\nThe starting date is " + parseInt(commons.startingDate.substring(5,7)) + "/" + parseInt(commons.startingDate.substring(8,10)) + "/" + parseInt(commons.startingDate)); } else { buttonLink(commons.id); } }} >{buttonText} </Button> </Col> } </Row> </Container> </Card.Body> ); }; export default CommonsCard; |