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/README.md b/README.md index a4241d05f..01e982446 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ 1. Replace `` with your Github username in the link - - [DEMO LINK](https://.github.io/js_task_generate_table_DOM/) + - [DEMO LINK](https://h-rostyslav.github.io/js_task_generate_table_DOM/) 2. Follow [this instructions](https://mate-academy.github.io/layout_task-guideline/) - Run `npm run test` command to test your code; - Run `npm run test:only -- -n` to run fast test ignoring linter; diff --git a/src/scripts/main.js b/src/scripts/main.js index 7d4a5db04..172c308a9 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -354,7 +354,22 @@ const people = [ }, ]; -// eslint-disable-next-line no-console -console.log(people); // you can remove it +const table = document.querySelector('.dashboard'); -// write your code here +people.forEach((person) => { + const row = document.createElement('tr'); + const age = person.died - person.born; + const century = Math.ceil(person.died / 100); + const gender = person.sex === 'm' ? 'Male' : 'Female'; + + row.innerHTML = ` + ${person.name} + ${gender} + ${person.born} + ${person.died} + ${age} + ${century} + `; + + table.append(row); +});