-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Develop #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Develop #1758
Changes from 5 commits
ca42dda
27217a2
f66f63d
a198be1
9104107
1304797
99329da
3549b95
eb8eae5
c5d87f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,26 @@ | |
| const tree = document.querySelector('#tree'); | ||
|
|
||
| function createTree(element, data) { | ||
| // WRITE YOUR CODE HERE | ||
| element = document.createElement('ul'); | ||
|
|
||
| for (const key in data) { | ||
| const firstList = document.createElement('li'); | ||
|
|
||
| firstList.textContent = key; | ||
|
|
||
| element.append(firstList); | ||
| document.body.append(element); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 31-32 appends the created |
||
|
|
||
| const testLength = Object.keys(data[key]).length; | ||
|
|
||
| if (testLength !== 0) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The recursive call passes |
||
| const next = createTree(firstList, data[key]); | ||
|
|
||
| firstList.append(next); | ||
| } | ||
| } | ||
|
|
||
| return element; | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The final tree is never appended to the |
||
| createTree(tree, food); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 24 overwrites the
elementparameter. The parameter should be used as the container, not replaced. Remove this line - you should create theulelement but append it to the passedelementparameter instead.