From ea4db2e477f807ed8f2fe97a0d676b10fa09a676 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 1 Jun 2017 18:11:40 +0200 Subject: [PATCH] test jest --- packages/metal-clay-icon/.babelrc | 3 +++ packages/metal-clay-icon/gulpfile.js | 1 + packages/metal-clay-icon/package.json | 2 +- .../src/__tests__/MetalClayIcon.js | 27 +++++++++++++++++++ .../__snapshots__/MetalClayIcon.js.snap | 3 +++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 packages/metal-clay-icon/.babelrc create mode 100644 packages/metal-clay-icon/src/__tests__/MetalClayIcon.js create mode 100644 packages/metal-clay-icon/src/__tests__/__snapshots__/MetalClayIcon.js.snap diff --git a/packages/metal-clay-icon/.babelrc b/packages/metal-clay-icon/.babelrc new file mode 100644 index 000000000..dc1bc4f9c --- /dev/null +++ b/packages/metal-clay-icon/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} \ No newline at end of file diff --git a/packages/metal-clay-icon/gulpfile.js b/packages/metal-clay-icon/gulpfile.js index d4a2da3cf..6571dc376 100644 --- a/packages/metal-clay-icon/gulpfile.js +++ b/packages/metal-clay-icon/gulpfile.js @@ -3,6 +3,7 @@ var metal = require('gulp-metal'); metal.registerTasks({ + gulp: require('gulp'), bundleCssFileName: 'metal-clay-icon.css', bundleFileName: 'metal-clay-icon.js', moduleName: 'metal-clay-icon' diff --git a/packages/metal-clay-icon/package.json b/packages/metal-clay-icon/package.json index 206890f92..5bfadd933 100644 --- a/packages/metal-clay-icon/package.json +++ b/packages/metal-clay-icon/package.json @@ -35,7 +35,7 @@ "babel-preset-es2015": "^6.14.0", "clay": "liferay/clay#develop", "gulp": "^3.8.11", - "gulp-metal": "^1.0.0", + "gulp-metal": "^2.0.0", "karma-html2js-preprocessor": "^1.0.0", "metal-karma-config": "^2.1.1" } diff --git a/packages/metal-clay-icon/src/__tests__/MetalClayIcon.js b/packages/metal-clay-icon/src/__tests__/MetalClayIcon.js new file mode 100644 index 000000000..730b54fd5 --- /dev/null +++ b/packages/metal-clay-icon/src/__tests__/MetalClayIcon.js @@ -0,0 +1,27 @@ +'use strict'; + +import MetalClayIcon from '../MetalClayIcon'; + +const spritemap = '../node_modules/lexicon-ux/build/images/icons/icons.svg'; + +let clayIcon; + +describe('MetalClayIcon', function() { + afterEach(() => { + if (clayIcon) { + clayIcon.dispose(); + } + }); + + it('should generate markup for icon `add-cell`', function() { + clayIcon = new MetalClayIcon( + { + spritemap: spritemap, + symbol: 'add-foo' + } + ); + + console.log(clayIcon.element.outerHTML); + expect(clayIcon.element.outerHTML).toMatchSnapshot(); + }); +}); diff --git a/packages/metal-clay-icon/src/__tests__/__snapshots__/MetalClayIcon.js.snap b/packages/metal-clay-icon/src/__tests__/__snapshots__/MetalClayIcon.js.snap new file mode 100644 index 000000000..5bc360c20 --- /dev/null +++ b/packages/metal-clay-icon/src/__tests__/__snapshots__/MetalClayIcon.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`MetalClayIcon should generate markup for icon \`add-cell\` 1`] = `"
"`;