Skip to content

Commit b6fb643

Browse files
committed
test(nested-collections): keep the tests in the subfolders: false scenario
1 parent 9580899 commit b6fb643

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

dev-test/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ collections: # A list of collections the CMS should be able to edit
6262
folder: '_restaurants'
6363
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
6464
summary: '{{title}} -- {{year}}/{{month}}/{{day}}'
65-
create: true # Allow users to create new documents in this collection
65+
create: true # Allow users to create new documents in this collection
6666
editor:
6767
visualEditing: true
6868
fields: # The fields each document in this collection have
@@ -276,7 +276,7 @@ collections: # A list of collections the CMS should be able to edit
276276
label_singular: 'Page'
277277
folder: _pages
278278
create: true
279-
nested: { depth: 100 }
279+
nested: { depth: 100, subfolders: false }
280280
fields:
281281
- label: Title
282282
name: title

packages/decap-cms-core/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ describe('EntriesCollection', () => {
115115
});
116116

117117
const { asFragment } = renderWithRedux(
118-
<ConnectedEntriesCollection collection={collection.set('nested', fromJS({ depth: 10 }))} />,
118+
<ConnectedEntriesCollection
119+
collection={collection.set('nested', fromJS({ depth: 10, subfolders: false }))}
120+
/>,
119121
{
120122
store,
121123
},
@@ -140,7 +142,7 @@ describe('EntriesCollection', () => {
140142

141143
const { asFragment } = renderWithRedux(
142144
<ConnectedEntriesCollection
143-
collection={collection.set('nested', fromJS({ depth: 10 }))}
145+
collection={collection.set('nested', fromJS({ depth: 10, subfolders: false }))}
144146
filterTerm="dir3/dir4"
145147
/>,
146148
{

packages/decap-cms-core/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`EntriesCollection should render show only immediate children for nested
1616
<DocumentFragment>
1717
<mock-entries
1818
collectionname="Pages"
19-
collections="Map { \\"name\\": \\"pages\\", \\"label\\": \\"Pages\\", \\"folder\\": \\"src/pages\\", \\"nested\\": Map { \\"depth\\": 10 } }"
19+
collections="Map { \\"name\\": \\"pages\\", \\"label\\": \\"Pages\\", \\"folder\\": \\"src/pages\\", \\"nested\\": Map { \\"depth\\": 10, \\"subfolders\\": false } }"
2020
cursor="[object Object]"
2121
entries="List [ Map { \\"slug\\": \\"index\\", \\"path\\": \\"src/pages/index.md\\", \\"data\\": Map { \\"title\\": \\"Root\\" } } ]"
2222
isfetching="false"
@@ -28,7 +28,7 @@ exports[`EntriesCollection should render with applied filter term for nested col
2828
<DocumentFragment>
2929
<mock-entries
3030
collectionname="Pages"
31-
collections="Map { \\"name\\": \\"pages\\", \\"label\\": \\"Pages\\", \\"folder\\": \\"src/pages\\", \\"nested\\": Map { \\"depth\\": 10 } }"
31+
collections="Map { \\"name\\": \\"pages\\", \\"label\\": \\"Pages\\", \\"folder\\": \\"src/pages\\", \\"nested\\": Map { \\"depth\\": 10, \\"subfolders\\": false } }"
3232
cursor="[object Object]"
3333
entries="List [ Map { \\"slug\\": \\"dir3/dir4/index\\", \\"path\\": \\"src/pages/dir3/dir4/index.md\\", \\"data\\": Map { \\"title\\": \\"File 4\\" } } ]"
3434
isfetching="false"

packages/decap-cms-core/src/components/Collection/__tests__/NestedCollection.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ describe('NestedCollection', () => {
3737
label: 'Pages',
3838
folder: 'src/pages',
3939
fields: [{ name: 'title', widget: 'string' }],
40+
nested: {
41+
subfolders: false,
42+
},
4043
});
4144

4245
it('should render correctly with no entries', () => {

0 commit comments

Comments
 (0)