Skip to content

Commit 3c9beef

Browse files
committedNov 5, 2023
Build: Add integration test for build task
1 parent 8bce38c commit 3c9beef

File tree

17 files changed

+470
-57
lines changed

17 files changed

+470
-57
lines changed
 

‎.github/workflows/node.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
2+
3+
name: Node.js
4+
5+
on:
6+
- push
7+
- pull_request
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- name: Install Debian packages
20+
run: sudo apt-get install -y libxml2-utils xsltproc
21+
- uses: actions/checkout@v3
22+
- name: Install Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
- run: npm ci
28+
- run: npm test

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
/node_modules
2+
/test/dist

‎Gruntfile.js

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
"use strict";
22

33
module.exports = function( grunt ) {
4+
grunt.initConfig( {
5+
"build-posts": {
6+
page: "fixture/pages/**"
7+
},
8+
"build-resources": {
9+
all: "fixture/resources/**"
10+
},
11+
"build-xml-entries": {
12+
all: "fixture/entries/**"
13+
},
14+
wordpress: {
15+
url: "example.org",
16+
username: "admin",
17+
password: "admin",
18+
dir: "test/dist/wordpress"
19+
}
20+
} );
421

5-
grunt.initConfig( {
6-
watch: {
7-
files: "<config:lint.files>",
8-
tasks: "default"
9-
},
10-
eslint: {
11-
files: [ "*.js", "lib/**/*.js", "tasks/**/*.js" ]
12-
}
13-
} );
14-
15-
grunt.loadNpmTasks( "grunt-eslint" );
16-
17-
grunt.registerTask( "default", "eslint" );
22+
grunt.loadTasks( "tasks" );
1823

24+
grunt.registerTask( "build", [ "build-posts", "build-resources", "build-xml-entries" ] );
1925
};

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Tested with QUnit](https://img.shields.io/badge/tested_with-qunit-9c3493.svg)](https://qunitjs.com/)
2+
13
# grunt-jquery-content
24

35
A collection of tasks for building the jQuery web sites via Grunt.

‎entries2html.xsl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2+
3+
<xsl:import href="tasks/jquery-xml/entries2html-base.xsl"/>
4+
5+
<xsl:template name="example-code">
6+
&lt;!doctype html&gt;
7+
<xsl:if test="css">&lt;style&gt;<xsl:value-of select="css/text()"/> &lt;/style&gt;</xsl:if>
8+
<xsl:copy-of select="html/text()"/>
9+
</xsl:template>
10+
11+
</xsl:stylesheet>

‎fixture/entries/addClass.xml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0"?>
2+
<entry type="method" name="addClass" return="jQuery">
3+
<title>.addClass()</title>
4+
<signature>
5+
<added>1.0</added>
6+
<argument name="className" type="String">
7+
<desc>One or more space-separated classes to be added.</desc>
8+
</argument>
9+
</signature>
10+
<signature>
11+
<added>1.4</added>
12+
<argument name="function" type="Function">
13+
<desc>A function returning one or more space-separated class names.</desc>
14+
<argument name="index" type="Integer" />
15+
<argument name="currentClassName" type="String" />
16+
<return type="String"/>
17+
</argument>
18+
</signature>
19+
<desc>Adds the specified class(es) to each element in the set of matched elements.</desc>
20+
<longdesc>
21+
<p>This method does not replace a class. It simply adds the class.</p>
22+
<pre><code>
23+
$( "p" ).addClass( "myClass yourClass" );
24+
</code></pre>
25+
<p>The <code>.addClass()</code> method changes the <code>className</code> <em>property</em> on the selected elements.</p>
26+
</longdesc>
27+
<example>
28+
<desc>Add the class "selected" to the matched elements.</desc>
29+
<css><![CDATA[
30+
p {
31+
margin: 8px;
32+
font-size: 16px;
33+
}
34+
.selected {
35+
color: blue;
36+
}
37+
.highlight {
38+
background: yellow;
39+
}
40+
]]></css>
41+
<html><![CDATA[
42+
<p>Hello</p>
43+
<p>and</p>
44+
<p>Goodbye</p>
45+
]]></html>
46+
</example>
47+
<category slug="css"/>
48+
<category slug="version/1.0"/>
49+
<category slug="version/1.4"/>
50+
</entry>

‎fixture/pages/Hello_World.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script>
2+
{
3+
"title": "Hello World"
4+
}
5+
</script>
6+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pellentesque placerat arcu, vel viverra augue posuere commodo. Aenean hendrerit quam sed commodo pellentesque.</p>
7+
<p>Donec sed commodo velit, non molestie justo.</p>
8+
<h3>Phasellus</h3>
9+
<p>Cras vel justo molestie lorem auctor convallis. Donec ac lacus tincidunt, euismod lectus eu, pulvinar tortor.</p>
10+
<pre><code> Hello.world({
11+
// Handle the event
12+
// ......
13+
});
14+
</code></pre>
15+
<h3>Sed sed molestie purus</h3>
16+
<p>Aliquam venenatis sem elit, et aliquet libero ultrices vitae. Nullam rutrum convallis justo, sed suscipit leo facilisis et.
17+
</p>

‎fixture/pages/Mark.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script>{
2+
"title": "Markdown"
3+
}</script>
4+
5+
**Conubia linguae** hydrae novissima recepto certe, clarus quod amictus tum ignota fluctibus *et quod*, est verba capitum, variusque. Sui saevam gentes propiora Cycladas, Hecate stamina nurus ramum!
6+
7+
## Oculi miserarum
8+
9+
Lorem [markdownum](https://en.wikipedia.org/wiki/Markdown) silentia umerique, colla. Per felix innoxia pariterque capillos accessit, nec ad tempore in nubes detrahitur.
10+
11+
Aures precantibus supplice Medusaeo, Lycormas est esse aestuat aut Pterelas.
12+
13+
## Domitos interea
14+
15+
1. Non torsi numine amor
16+
2. Tamen vino hinc indignatus aquas iunguntur sacrifica
17+
3. Solitum bacae tellure ille

‎fixture/resources/x.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x

0 commit comments

Comments
 (0)
Please sign in to comment.