• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

memory-cards / cards-exporter / 105

pending completion
105

Pull #30

travis-ci

web-flow
Merge branch 'update-cards-page' of https://github.com/memory-cards/cards-exporter into update-cards-page
Pull Request #30: add basic updateCards page

62 of 65 branches covered (95.38%)

Branch coverage included in aggregate %.

96 of 96 new or added lines in 7 files covered. (100.0%)

226 of 233 relevant lines covered (97.0%)

17.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/pages/updateCards/components/CardsList/components/Card/index.tsx
1
import * as React from "react";
3✔
2
import { ICardDefinition } from "~/typings/ICardDefinition";
3

4
import "./styles.scss";
3✔
5

6
interface Props {
7
  card: ICardDefinition;
8
  selectCard: (selectedCard: ICardDefinition) => void;
9
  isSelected: boolean;
10
}
11

12
const Card = ({ card, selectCard, isSelected }: Props) => {
3✔
13
  const onClick = () => {
12✔
14
    selectCard(card);
×
15
  };
16

17
  const getShortCardQuestion = () => {
12✔
18
    const element = window.document.createElement("div");
12✔
19
    element.innerHTML = card.card.question;
12✔
20
    const text = element.innerText
12✔
21
      .split(" ")
22
      .slice(0, 10)
23
      .map(word => (word.length < 30 ? word : word.substr(0, 30)))
97✔
24
      .join(" ");
25
    return text.length < element.innerText.length ? `${text}...` : text;
12✔
26
  };
27

28
  return (
12✔
29
    <li className={isSelected ? "card selected" : "card"} onClick={onClick}>
12✔
30
      <div>{getShortCardQuestion()}</div>
31
      <br />
32
      <div>
33
        {card.tags.map(tag => (
34
          <span key={tag} className="tag">
22✔
35
            {tag}
36
          </span>
37
        ))}
38
      </div>
39
    </li>
40
  );
41
};
42

43
export default Card;
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2024 Coveralls, Inc