Skip to content

Commit 6977777

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/dev' into fix-hidden-pattern-references
2 parents cdeab80 + 1df0dca commit 6977777

8 files changed

+1065
-1055
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: node_js
33
node_js:
44
- node
55
- 6
6-
- 5
76
- 4
87

98
before_install:

Gruntfile.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ module.exports = function (grunt) {
1919
nodeunit: {
2020
all: ['test/*_tests.js']
2121
},
22+
tape: {
23+
options: {
24+
pretty: true,
25+
output: 'console'
26+
},
27+
files: ['test/*_tests.js']
28+
},
2229
eslint: {
2330
options: {
2431
configFile: './.eslintrc'
@@ -31,11 +38,12 @@ module.exports = function (grunt) {
3138
grunt.loadNpmTasks('grunt-contrib-concat');
3239
grunt.loadNpmTasks('grunt-eslint');
3340
grunt.loadNpmTasks('grunt-contrib-nodeunit');
41+
grunt.loadNpmTasks('grunt-tape');
3442

3543
//travis CI task
36-
grunt.registerTask('travis', ['nodeunit', 'eslint']);
44+
grunt.registerTask('travis', ['nodeunit', 'tape', 'eslint']);
3745

3846
//to be run prior to releasing a version
39-
grunt.registerTask('build', ['nodeunit', 'eslint', 'concat']);
47+
grunt.registerTask('build', ['nodeunit', 'tape', 'eslint', 'concat']);
4048

4149
};

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"grunt": "~1.0.1",
2020
"grunt-contrib-concat": "^1.0.1",
2121
"grunt-contrib-nodeunit": "^1.0.0",
22-
"grunt-eslint": "^18.0.0"
22+
"grunt-eslint": "^18.0.0",
23+
"grunt-tape": "^0.1.0",
24+
"tap": "^7.1.2"
2325
},
2426
"keywords": [
2527
"Pattern Lab",
@@ -44,7 +46,7 @@
4446
],
4547
"license": "MIT",
4648
"scripts": {
47-
"test": "grunt travis --verbose"
49+
"test": "node_modules/grunt/bin/grunt travis --verbose"
4850
},
4951
"engines": {
5052
"node": ">=4.0"

test/annotation_exporter_tests.js

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

3-
var eol = require('os').EOL;
4-
var Pattern = require('../core/lib/object_factory').Pattern;
3+
var tap = require('tap');
4+
55
var extend = require('util')._extend;
66
var anPath = './test/files/';
77

@@ -22,59 +22,55 @@ function createFakePatternLab(anPath, customProps) {
2222
var patternlab = createFakePatternLab(anPath);
2323
var ae = require('../core/lib/annotation_exporter')(patternlab);
2424

25-
exports['annotaton_exporter'] = {
26-
27-
'converts old JS annotations into new format': function (test) {
28-
//arrange
29-
//act
30-
var annotations = ae.gatherJS();
31-
32-
//assert
33-
test.equals(annotations.length, 2);
34-
test.equals(annotations[1].el, '.logo');
35-
test.equals(annotations[1].title, 'Logo');
36-
test.equals(annotations[1].comment, "The logo image is an SVG file, which ensures that the logo displays crisply even on high resolution displays. A PNG fallback is provided for browsers that don't support SVG images.</p><p>Further reading: <a href=\"http://bradfrostweb.com/blog/mobile/hi-res-optimization/\">Optimizing Web Experiences for High Resolution Screens</a></p>");
37-
38-
test.done();
39-
},
40-
41-
'converts new markdown annotations into an array': function (test) {
42-
//arrange
43-
//act
44-
var annotations = ae.gatherMD();
45-
46-
//assert
47-
test.equals(annotations.length, 3);
48-
test.equals(annotations[1].el, '.logo');
49-
test.equals(annotations[1].title, 'Logo');
50-
test.equals(annotations[1].comment.replace(/\r?\n|\r/gm, ""), '<p>The <em>logo image</em> is an SVG file.</p>');
51-
52-
test.done();
53-
},
54-
55-
'merges both annotation methods into one array' : function (test) {
56-
//arrange
57-
58-
//act
59-
var annotations = ae.gather();
60-
61-
//assert
62-
test.equals(annotations.length, 3);
63-
test.equals(annotations[2].el, '#nav');
64-
test.equals(annotations[2].title, 'Navigation');
65-
test.equals(annotations[2].comment.replace(/\r?\n|\r/gm, ""), '<p>Navigation for adaptive web experiences can be tricky. Refer to <a href="https://bradfrost.github.io/this-is-responsive/patterns.html#navigation">these repsonsive patterns</a> when evaluating solutions.</p>');
66-
67-
test.done();
68-
69-
},
70-
71-
'when there are 0 annotation files' : function (test) {
72-
var emptyAnPath = './test/files/empty/';
73-
var patternlab2 = createFakePatternLab(emptyAnPath);
74-
var ae2 = require('../core/lib/annotation_exporter')(patternlab2);
75-
76-
var annotations = ae2.gather();
77-
test.equals(annotations.length, 0);
78-
test.done();
79-
}
80-
};
25+
tap.test('converts old JS annotations into new format', function (test) {
26+
//arrange
27+
//act
28+
var annotations = ae.gatherJS();
29+
30+
//assert
31+
test.equals(annotations.length, 2);
32+
test.equals(annotations[1].el, '.logo');
33+
test.equals(annotations[1].title, 'Logo');
34+
test.equals(annotations[1].comment, "The logo image is an SVG file, which ensures that the logo displays crisply even on high resolution displays. A PNG fallback is provided for browsers that don't support SVG images.</p><p>Further reading: <a href=\"http://bradfrostweb.com/blog/mobile/hi-res-optimization/\">Optimizing Web Experiences for High Resolution Screens</a></p>");
35+
36+
test.end();
37+
});
38+
39+
tap.test('converts new markdown annotations into an array', function (test) {
40+
//arrange
41+
//act
42+
var annotations = ae.gatherMD();
43+
44+
//assert
45+
test.equals(annotations.length, 3);
46+
test.equals(annotations[1].el, '.logo');
47+
test.equals(annotations[1].title, 'Logo');
48+
test.equals(annotations[1].comment.replace(/\r?\n|\r/gm, ""), '<p>The <em>logo image</em> is an SVG file.</p>');
49+
50+
test.end();
51+
});
52+
53+
tap.test('merges both annotation methods into one array', function (test) {
54+
//arrange
55+
56+
//act
57+
var annotations = ae.gather();
58+
59+
//assert
60+
test.equals(annotations.length, 3);
61+
test.equals(annotations[2].el, '#nav');
62+
test.equals(annotations[2].title, 'Navigation');
63+
test.equals(annotations[2].comment.replace(/\r?\n|\r/gm, ""), '<p>Navigation for adaptive web experiences can be tricky. Refer to <a href="https://bradfrost.github.io/this-is-responsive/patterns.html#navigation">these repsonsive patterns</a> when evaluating solutions.</p>');
64+
65+
test.end();
66+
});
67+
68+
tap.test('when there are 0 annotation files', function (test) {
69+
var emptyAnPath = './test/files/empty/';
70+
var patternlab2 = createFakePatternLab(emptyAnPath);
71+
var ae2 = require('../core/lib/annotation_exporter')(patternlab2);
72+
73+
var annotations = ae2.gather();
74+
test.equals(annotations.length, 0);
75+
test.end();
76+
});

0 commit comments

Comments
 (0)