diff --git a/.github/workflows/test.yml-template b/.github/workflows/test.yml-template new file mode 100644 index 000000000..44ac4e963 --- /dev/null +++ b/.github/workflows/test.yml-template @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm start & sleep 5 && npm test + - name: Upload tests report(cypress mochaawesome merged HTML report) + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: report + path: reports diff --git a/src/scripts/main.js b/src/scripts/main.js index 7d4a5db04..262e987cf 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -354,7 +354,39 @@ const people = [ }, ]; -// eslint-disable-next-line no-console -console.log(people); // you can remove it +const table = document.querySelector('.dashboard'); -// write your code here +if (table) { + const tableBody = table.querySelector('tbody') || table; + + people.forEach((person) => { + const row = document.createElement('tr'); + + const cellName = document.createElement('td'); + + cellName.textContent = person.name; + + const cellGender = document.createElement('td'); + + cellGender.textContent = person.sex === 'm' ? 'Male' : 'Female'; + + const cellBorn = document.createElement('td'); + + cellBorn.textContent = person.born; + + const cellDied = document.createElement('td'); + + cellDied.textContent = person.died; + + const cellAge = document.createElement('td'); + + cellAge.textContent = person.died - person.born; + + const cellCentury = document.createElement('td'); + + cellCentury.textContent = Math.ceil(person.died / 100); + + row.append(cellName, cellGender, cellBorn, cellDied, cellAge, cellCentury); + tableBody.append(row); + }); +}