Permalink
Browse files

cleaned up testing response

  • Loading branch information...
crcn committed Feb 28, 2012
1 parent cb888ad commit 4f7bf724d6532f386c8f98cc82b598055b1eb16d
View
@@ -6,6 +6,7 @@
- HTML compatibility checking for popular email clients. See:
- http://www.campaignmonitor.com/css/
- http://www.campaignmonitor.com/downloads/documents-tools/campaign-monitor-guide-to-css-in-email-sept-2011.pdf
+ - http://www.email-standards.org/
### HTML Example
@@ -40,7 +41,7 @@ Into this:
### Testing Compatibility Screenshot
-![Alt command line](http://i.imgur.com/xpsyQ.png)
+![Alt command line](http://i.imgur.com/AUX7z.png)
### Requirements
@@ -90,28 +91,34 @@ emailify -i /my/html/file.html
### Node.js API
-#### .parse(content, callback)
+#### .parse(content[, options], callback)
parses html content into email-safe html
+- `content` - the html content
+- `options`
+ `test` - runs test against code for compatibility
+
+
```javascript
var emailify = require('emailify'),
fs = require('fs')
-emailify.parse(fs.readFileSync('/my/email/newsletter.html', 'utf8'), function(err, content) {
+emailify.parse(fs.readFileSync('/my/email/newsletter.html', 'utf8'), function(err, content, warnings) {
//send newsletter
});
```
-#### .load(file, callback)
+#### .load(file[, options], callback)
+
loads a html file
```javascript
var emailify = require('emailify'),
fs = require('fs')
-emailify.load('/my/email/newsletter.html', function(err, content) {
+emailify.load('/my/email/newsletter.html', function(err, content, warnings) {
//send newsletter
});
```
View
@@ -10,9 +10,10 @@ alias('o','output').
alias('t','test').
argv;
-var fs = require('fs'),
+var fs = require('fs'),
emailify = require('../'),
-outcome = require('outcome');
+outcome = require('outcome'),
+celeri = require('celeri');
/**
*/
@@ -27,7 +28,7 @@ function fixFile(file) {
*/
var on = outcome.error(function(err) {
-
+
console.error(err);
});
@@ -36,8 +37,8 @@ var on = outcome.error(function(err) {
*/
-emailify.load(fixFile(argv.i), { test: argv.t }, on.success(function(content) {
-
+emailify.load(fixFile(argv.i), { test: argv.t }, on.success(function(content, warnings) {
+
if(argv.o) {
fs.writeFile(fixFile(argv.o), content, on);
@@ -48,4 +49,45 @@ emailify.load(fixFile(argv.i), { test: argv.t }, on.success(function(content) {
console.log(content);
}
-}));
+ printWarnings(warnings);
+
+}));
+
+
+/**
+ */
+
+function printWarnings(warnings) {
+
+ if(!warnings.length) return;
+
+ var toPrint = [];
+
+ for(var i = warnings.length; i--;) {
+ var warning = warnings[i];
+
+ toPrint.push({
+ type: warning.type,
+ platforms: warning.platforms.join("\n "),
+ value: warning.value
+ });
+ }
+
+
+ console.log('\n');
+ console.log(' Unsupported Clients'.bold);
+
+ celeri.table(toPrint, {
+ columns: {
+ type: 9,
+ value: 15,
+ platforms: 26
+ },
+ pad: {
+ 'left': 3
+ },
+ horz:' ',
+ fixed: true
+ });
+ console.log('\n');
+}
@@ -6,6 +6,10 @@
box-shadow: #ff6600;
}
+ a:hover {
+
+ }
+
</style>
</head>
<body>
View
@@ -38,6 +38,7 @@ function _parse(content, options, callback) {
var on = outcome.error(callback),
+ warnings,
window;
step(
@@ -92,12 +93,14 @@ function _parse(content, options, callback) {
* clean it.
*/
- function() {
+ on.success(function(warn) {
+
+ warnings = warn;
window.$('script, link, style').remove();
this();
- },
+ }),
/**
@@ -106,7 +109,7 @@ function _parse(content, options, callback) {
function() {
- callback(null, window.document.innerHTML);
+ callback(null, window.document.innerHTML, warnings || []);
}
);
@@ -1,12 +1,11 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Android - 1.7%': {
-
- 'styles': utils.doesNotContainStylesBatch(
+ 'name':'Android',
+ 'test': {
+ 'style': [
//TEXT
'word-wrap',
@@ -43,7 +42,7 @@ module.exports = {
//TABLE
'border-spacing',
'caption-side',
- 'empty-cells')
+ 'empty-cells']
}
@@ -1,16 +1,16 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Apple Mail 4 - 11%': {
+ 'name': 'Apple Mail 4',
+ 'test': {
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//BOX
'box-shadow',
- 'caption-side')
+ 'caption-side']
}
@@ -1,11 +1,11 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'GMail - 7%': {
+ 'name': 'GMail',
+ 'test': {
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//TEXT
@@ -41,7 +41,7 @@ module.exports = {
//TABLE
'border-spacing',
'caption-side',
- 'empty-cells')
+ 'empty-cells']
}
@@ -1,11 +1,11 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Hotmail - 12%': {
+ 'name': 'Hotmail',
+ 'test': {
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//BG
'background-image',
@@ -23,7 +23,7 @@ module.exports = {
//LISTS
'list-style-image',
- 'list-style-position')
+ 'list-style-position']
}
@@ -1,17 +1,17 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Apple iPhone/iPad - 16%': {
+ 'name': 'Apple iPhone/iPad',
+ 'test': {
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//BOX
'box-shadow',
//TABLE
- 'caption-side')
+ 'caption-side']
}
};
@@ -1,11 +1,10 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
+ 'name': 'Outlook Express 2000/2003',
+ 'test': {
- 'Outlook Express 2000/2003 - 27%': {
-
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//TEXT
'text-shadow',
@@ -27,7 +26,7 @@ module.exports = {
//TABLE
'border-spacing',
'caption-side',
- 'empty-cells')
+ 'empty-cells']
}
@@ -1,11 +1,11 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Outlook Express 2007/2010 - 27%': {
+ 'name': 'Outlook Express 2007/2010',
+ 'test': {
- 'styles': utils.doesNotContainStylesBatch(
+ 'style': [
//TEXT
@@ -53,7 +53,7 @@ module.exports = {
//TABLE
'border-spacing',
'caption-side',
- 'empty-cells')
+ 'empty-cells']
}
@@ -1,11 +1,12 @@
-var assert = require('assert'),
-utils = require('../utils');
+var assert = require('assert');
module.exports = {
- 'Yahoo! Mail - 9%': {
+ 'name': 'Yahoo! Mail',
- 'styles': utils.doesNotContainStylesBatch(
+ 'test': {
+
+ 'style': [
//BG
'background-image',
@@ -26,8 +27,8 @@ module.exports = {
'resize',
'right',
'top',
- 'z-index')
+ 'z-index']
}
-
+
};
Oops, something went wrong.

0 comments on commit 4f7bf72

Please sign in to comment.