[Pkg-javascript-commits] [node-cssstyle] 08/39: added 21 missing properties and created some basic unit tests
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Sep 20 19:37:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository node-cssstyle.
commit f594589dead36ccd91bf275c80d9403084b6e9d6
Author: Chad Walker <chad at chad-cat-lore-eddie.com>
Date: Thu Jul 12 22:14:06 2012 -0700
added 21 missing properties and created some basic unit tests
---
.gitignore | 1 +
lib/CSSStyleDeclaration.js | 189 +++++++++++++++++++++++++++++++++++++++++++++
tests/tests.js | 73 +++++++++++++++++
3 files changed, 263 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file
diff --git a/lib/CSSStyleDeclaration.js b/lib/CSSStyleDeclaration.js
index cf08501..a768adb 100644
--- a/lib/CSSStyleDeclaration.js
+++ b/lib/CSSStyleDeclaration.js
@@ -796,6 +796,33 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ cue: {
+ set: function (v) {
+ this.setProperty('cue', v);
+ },
+ get: function () {
+ return this.getPropertyValue('cue');
+ },
+ enumerable: true
+ },
+ cueAfter: {
+ set: function (v) {
+ this.setProperty('cue-after', v);
+ },
+ get: function () {
+ return this.getPropertyValue('cue-after');
+ },
+ enumerable: true
+ },
+ cueBefore: {
+ set: function (v) {
+ this.setProperty('cue-before', v);
+ },
+ get: function () {
+ return this.getPropertyValue('cue-before');
+ },
+ enumerable: true
+ },
cursor: {
set: function (v) {
this.setProperty('cursor', v);
@@ -832,6 +859,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ elevation: {
+ set: function (v) {
+ this.setProperty('elevation', v);
+ },
+ get: function () {
+ return this.getPropertyValue('elevation');
+ },
+ enumerable: true
+ },
emptyCells: {
set: function (v) {
this.setProperty('empty-cells', v);
@@ -940,6 +976,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ fontSizeAdjust: {
+ set: function (v) {
+ this.setProperty('font-size-adjust', v);
+ },
+ get: function () {
+ return this.getPropertyValue('font-size-adjust');
+ },
+ enumerable: true
+ },
fontStretch: {
set: function (v) {
this.setProperty('font-stretch', v);
@@ -1165,6 +1210,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ markerOffset: {
+ set: function (v) {
+ this.setProperty('marker-offset', v);
+ },
+ get: function () {
+ return this.getPropertyValue('marker-offset');
+ },
+ enumerable: true
+ },
markerStart: {
set: function (v) {
this.setProperty('marker-start', v);
@@ -1174,6 +1228,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ marks: {
+ set: function (v) {
+ this.setProperty('marks', v);
+ },
+ get: function () {
+ return this.getPropertyValue('marks');
+ },
+ enumerable: true
+ },
mask: {
set: function (v) {
this.setProperty('mask', v);
@@ -1390,6 +1453,60 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ pause: {
+ set: function (v) {
+ this.setProperty('pause', v);
+ },
+ get: function () {
+ return this.getPropertyValue('pause');
+ },
+ enumerable: true
+ },
+ pauseAfter: {
+ set: function (v) {
+ this.setProperty('pause-after', v);
+ },
+ get: function () {
+ return this.getPropertyValue('pause-after');
+ },
+ enumerable: true
+ },
+ pauseBefore: {
+ set: function (v) {
+ this.setProperty('pause-before', v);
+ },
+ get: function () {
+ return this.getPropertyValue('pause-before');
+ },
+ enumerable: true
+ },
+ pitch: {
+ set: function (v) {
+ this.setProperty('pitch', v);
+ },
+ get: function () {
+ return this.getPropertyValue('pitch');
+ },
+ enumerable: true
+ },
+ pitchRange: {
+ set: function (v) {
+ this.setProperty('pitch-range', v);
+ },
+ get: function () {
+ return this.getPropertyValue('pitch-range');
+ },
+ enumerable: true
+ },
+ playDuring: {
+ set: function (v) {
+ this.setProperty('play-during', v);
+ },
+ get: function () {
+ return this.getPropertyValue('play-during');
+ },
+ enumerable: true
+ },
pointerEvents: {
set: function (v) {
this.setProperty('pointer-events', v);
@@ -1417,6 +1534,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ richness: {
+ set: function (v) {
+ this.setProperty('richness', v);
+ },
+ get: function () {
+ return this.getPropertyValue('richness');
+ },
+ enumerable: true
+ },
resize: {
set: function (v) {
this.setProperty('resize', v);
@@ -1462,6 +1588,42 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ speakHeader: {
+ set: function (v) {
+ this.setProperty('speak-header', v);
+ },
+ get: function () {
+ return this.getPropertyValue('speak-header');
+ },
+ enumerable: true
+ },
+ speakNumeral: {
+ set: function (v) {
+ this.setProperty('speak-numeral', v);
+ },
+ get: function () {
+ return this.getPropertyValue('speak-numeral');
+ },
+ enumerable: true
+ },
+ speakPunctuation: {
+ set: function (v) {
+ this.setProperty('speak-punctuation', v);
+ },
+ get: function () {
+ return this.getPropertyValue('speak-punctuation');
+ },
+ enumerable: true
+ },
+ speechRate: {
+ set: function (v) {
+ this.setProperty('speech-rate', v);
+ },
+ get: function () {
+ return this.getPropertyValue('speech-rate');
+ },
+ enumerable: true
+ },
src: {
set: function (v) {
this.setProperty('src', v);
@@ -1489,6 +1651,15 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ stress: {
+ set: function (v) {
+ this.setProperty('stress', v);
+ },
+ get: function () {
+ return this.getPropertyValue('stress');
+ },
+ enumerable: true
+ },
stroke: {
set: function (v) {
this.setProperty('stroke', v);
@@ -1831,6 +2002,24 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
},
enumerable: true
},
+ voiceFamily: {
+ set: function (v) {
+ this.setProperty('voic-family', v);
+ },
+ get: function () {
+ return this.getPropertyValue('voice-family');
+ },
+ enumerable: true
+ },
+ volume: {
+ set: function (v) {
+ this.setProperty('volume', v);
+ },
+ get: function () {
+ return this.getPropertyValue('volume');
+ },
+ enumerable: true
+ },
webkitAnimation: {
set: function (v) {
this.setProperty('-webkit-animation', v);
diff --git a/tests/tests.js b/tests/tests.js
new file mode 100644
index 0000000..6293cc0
--- /dev/null
+++ b/tests/tests.js
@@ -0,0 +1,73 @@
+"use strict";
+
+var cssstyle = require('../lib/CSSStyleDeclaration');
+
+/**
+ * These are the required properties
+ * see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties
+ **/
+var properties = [ 'azimuth', 'background', 'backgroundAttachment', 'backgroundColor', 'backgroundImage', 'backgroundPosition', 'backgroundRepeat', 'border', 'borderCollapse', 'borderColor', 'borderSpacing', 'borderStyle', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor', 'borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidt [...]
+
+module.exports = {
+ 'Verify Has Properties': function (test) {
+ var style = new cssstyle.CSSStyleDeclaration();
+ test.expect(properties.length);
+ properties.forEach(function (property) {
+ test.ok(style.hasOwnProperty(property), 'missing ' + property + ' property');
+ });
+ test.done();
+ },
+ 'Verify Has Functions': function (test) {
+ var style = new cssstyle.CSSStyleDeclaration();
+ test.expect(6);
+ test.ok(typeof style.getPropertyValue === 'function', 'missing getPropertyValue()');
+ test.ok(typeof style.getPropertyCSSValue === 'function', 'missing getPropertyCSSValue()');
+ test.ok(typeof style.removeProperty === 'function', 'missing removeProperty()');
+ test.ok(typeof style.getPropertyPriority === 'function', 'missing getPropertyPriority()');
+ test.ok(typeof style.setProperty === 'function', 'missing setProperty()');
+ test.ok(typeof style.item === 'function', 'missing item()');
+ test.done();
+ },
+ 'Verify Has Special Properties': function (test) {
+ var style = new cssstyle.CSSStyleDeclaration();
+ test.expect(3);
+ test.ok(style.hasOwnProperty('cssText'), 'missing cssText property');
+ test.ok(style.hasOwnProperty('length'), 'missing length property');
+ test.ok(style.hasOwnProperty('parentRule'), 'missing parentRule property');
+ test.done();
+ },
+ 'Test From Style String': function (test) {
+ var style = new cssstyle.CSSStyleDeclaration();
+ test.expect(8);
+ style.cssText = 'color: blue; background-color: red; width: 78%';
+ test.ok(3 === style.length, 'length is not 3');
+ test.ok('color: blue; background-color: red; width: 78%; ' === style.cssText, 'cssText is wrong');
+ test.ok('blue' === style.getPropertyValue('color'), "getPropertyValue('color') failed");
+ test.ok('color' === style.item(0), 'item(0) failed');
+ test.ok('background-color' === style[1], 'style[1] failed');
+ test.ok('red' === style.backgroundColor, 'style.backgroundColor failed');
+ style.cssText = '';
+ test.ok('' === style.cssText, 'cssText is not empty');
+ test.ok(0 === style.length, 'length is not 0');
+ test.done();
+ },
+ 'Test From Properties': function (test) {
+ var style = new cssstyle.CSSStyleDeclaration();
+ test.expect(11);
+ style.color = 'blue';
+ test.ok(1 === style.length, 'length is not 1');
+ test.ok('color' === style[0], 'style[0] is not color');
+ test.ok('color: blue; ' === style.cssText, 'cssText is wrong');
+ test.ok('color' === style.item(0), 'item(0) is not color');
+ test.ok('blue' === style.color, 'color is not blue');
+ style.backgroundColor = 'red';
+ test.ok(2 === style.length, 'length is not 2');
+ test.ok('color' === style[0], 'style[0] is not color');
+ test.ok('background-color' === style[1], 'style[1] is not background-color');
+ test.ok('color: blue; background-color: red; ' === style.cssText, 'cssText is wrong');
+ test.ok('red' === style.backgroundColor, 'backgroundColor is not red');
+ style.removeProperty('color');
+ test.ok('background-color' === style[0], 'style[0] is not background-color');
+ test.done();
+ }
+};
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-cssstyle.git
More information about the Pkg-javascript-commits
mailing list