-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
904e79c
commit 0739582
Showing
8 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/toolkit/__tests__/build-project-vanilla-extract/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./dist |
43 changes: 43 additions & 0 deletions
43
...t/__tests__/build-project-vanilla-extract/__fixtures__/includes/blocks/example/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"title": "Example Block", | ||
"description": "An Example Block", | ||
"textdomain": "tenup-scaffold", | ||
"name": "tenup/example", | ||
"icon": "feedback", | ||
"category": "tenup-scaffold-blocks", | ||
"attributes": { | ||
"title": { | ||
"type": "string" | ||
} | ||
}, | ||
"example": { | ||
"attributes": { | ||
"title": "Example Block" | ||
} | ||
}, | ||
"supports": { | ||
"align": false, | ||
"alignWide": false, | ||
"anchor": false, | ||
"color": { | ||
"gradients": false, | ||
"background": false, | ||
"text": false | ||
}, | ||
"customClassName": false, | ||
"defaultStylePicker": false, | ||
"typography": { | ||
"fontSize": false, | ||
"lineHeight": true | ||
}, | ||
"html": false, | ||
"inserter": true, | ||
"multiple": true, | ||
"reusable": false, | ||
"spacing": { | ||
"padding": false | ||
} | ||
}, | ||
"editorScript": "file:./index.js", | ||
"editorStyle": "file:./index.css" | ||
} |
8 changes: 8 additions & 0 deletions
8
...lkit/__tests__/build-project-vanilla-extract/__fixtures__/includes/blocks/example/edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable */ | ||
import { container } from './styles.css.ts'; | ||
|
||
const ExampleBlockEdit = () => { | ||
return <div className={container} /> | ||
}; | ||
|
||
export default ExampleBlockEdit; |
11 changes: 11 additions & 0 deletions
11
...kit/__tests__/build-project-vanilla-extract/__fixtures__/includes/blocks/example/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
|
||
import edit from './edit'; | ||
import save from './save'; | ||
import block from './block.json'; | ||
|
||
registerBlockType(block, { | ||
edit, | ||
save, | ||
}); |
8 changes: 8 additions & 0 deletions
8
...lkit/__tests__/build-project-vanilla-extract/__fixtures__/includes/blocks/example/save.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save | ||
* | ||
* @returns {null} Dynamic blocks do not save the HTML. | ||
*/ | ||
const ExampleBlockSave = () => null; | ||
|
||
export default ExampleBlockSave; |
6 changes: 6 additions & 0 deletions
6
..._tests__/build-project-vanilla-extract/__fixtures__/includes/blocks/example/styles.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const container = style({ | ||
border: '2px dashed black', | ||
backgroundColor: 'red', | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/toolkit/__tests__/build-project-vanilla-extract/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "test-build-project-linaria", | ||
"10up-toolkit": { | ||
"useBlockAssets": true, | ||
"paths": { | ||
"blocksDir": "./__fixtures__/includes/blocks" | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/toolkit/__tests__/build-project-vanilla-extract/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import spawn from 'cross-spawn'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
describe('build a project (with vanilla-extract)', () => { | ||
beforeAll(() => { | ||
spawn.sync('node', ['../../scripts/build'], { | ||
cwd: __dirname, | ||
}); | ||
}); | ||
|
||
it('builds blocks', () => { | ||
expect( | ||
fs.existsSync(path.join(__dirname, 'dist', 'blocks', 'example', 'block.json')), | ||
).toBeTruthy(); | ||
|
||
expect( | ||
fs.existsSync(path.join(__dirname, 'dist', 'blocks', 'example', 'index.js')), | ||
).toBeTruthy(); | ||
|
||
const indexCSS = path.join(__dirname, 'dist', 'blocks', 'example', 'index.css'); | ||
expect(fs.existsSync(indexCSS)).toBeTruthy(); | ||
|
||
// ensure it is extracting the css-in-js | ||
const compiledCSS = fs.readFileSync(indexCSS).toString(); | ||
expect(compiledCSS).toMatch('border: 2px dashed black'); | ||
}); | ||
}); |