Build an Availability Table - Build an Availability Table

Tell us what’s happening:

I keep failing the 11th test, even if I pass 12. Looks like there’s an error on my side, but I have tried everityng. I suspect maybe it is a bug/browser thing.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css" />
    <title>Availability Table</title>
</head>

<body>

    <table>
        <caption>Weekly Meeting Availability Schedule</caption>
        <thead>
            <tr>
                <th scope="col">Martes</th>
                <th scope="col">Miércoles</th>
                <th scope="col">Jueves</th>
                <th scope="col">Viernes</th>
                <th scope="col">Sábado</th>
                <th scope="col">Domingo</th>
            </tr>
        </thead>
        <tbody>
            <tr class="time sharp">
                <th class="time" scope="row">1pm</th>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>

            </tr>
            <tr class="time half">
                <th class="time" scope="row">2pm</th>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>

            </tr>
            <tr class="time sharp">
                <th class="time" scope="row">3pm</th>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>

            </tr>
            <tr class="time half">
                <th class="time" scope="row">4pm</th>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>
                <td class="available-0"></td>

            </tr>
        </tbody>
    </table>
    <div id="legend">
        <span>Availability</span>
        <div id="legend-gradient"></div>
    </div>
</body>

</html>
/* file: styles.css */
:root {
  --solid-border: black;
  --dashed-border: red;
  --color0: pink;
  --color1: green;
  --color2: lime;
  --color3: yellow;
  --color4: blue;
  --color5: midnightblue;
}

.available-0{
  background-color: var(--color0);
}
.available-1{
  background-color: var(--color1);
}
.available-2{
  background-color: var(--color2);
}
.available-3{
  background-color: var(--color3);
}
.available-4{
  background-color: var(--color4);
}
.available-5{
  background-color: var(--color5)
}

#legend-gradient {
  width: 100px;
  height: 10px;
  background-image: linear-gradient(to right,
  var(--color0), var(--color0) 20%,
  var(--color1) 20%, var(--color1) 40%,
  var(--color3) 40%, var(--color3) 60%,
  var(--color4) 60%, var(--color4) 80%,
  var(--color5) 80%, var(--color5) 100%)
}

td{
  border:solid 1px black;
}

.sharp{
  border-bottom:solid 2px var(--solid-border);
}

.half{
  border-bottom:dashed 2px var(--dashed-border);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36

Challenge Information:

Build an Availability Table - Build an Availability Table

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-availability-table/66b36358ed4f261d64840c24.md at main · freeCodeCamp/freeCodeCamp · GitHub

Oh, the problem was that the test checks for strictly the rows with only and only half sharp. So as I had “time” also on the clases, that test simply didn’t saw any. After removing time, it worked.

All your td elements should have the class of available-#, where # is a number from 0 to 5.

const cells = [...document.querySelectorAll('tr[class="sharp"]>td, tr[class="half"]>td')];
assert.isNotEmpty(cells);
for (let cell of cells) {
    const classString = [...cell.classList].join(' ');
    assert.lengthOf(classString.match(/(?<=\s|^)available-[0-5](?=\s|$)/gm), 1);
}