Repository: jsdom/cssstyle (js)

Issue:
Background properites misnamed as "backgound" (missing the 'r')
See: https://github.com/jsdom/cssstyle/blob/7ed8c6cf29bd1fcf53af19cc5726a950b7950e30/lib/properties/backgroundColor.js#L25

I suspect this may have been copy-pasted into other background properties.

Pull request:
fix background-* spelling
Closes #214 

Patch:
diff --git a/lib/properties/backgroundAttachment.js b/lib/properties/backgroundAttachment.js
index 360e51b..db37e2c 100644
--- a/lib/properties/backgroundAttachment.js
+++ b/lib/properties/backgroundAttachment.js
@@ -19,7 +19,7 @@ module.exports.definition = {
     v = parsers.prepareValue(v, this._global);
     if (parsers.hasVarFunc(v)) {
       this._setProperty("background", "");
-      this._setProperty("backgound-attachemnt", v);
+      this._setProperty("background-attachemnt", v);
     } else {
       this._setProperty("background-attachment", module.exports.parse(v));
     }
diff --git a/lib/properties/backgroundColor.js b/lib/properties/backgroundColor.js
index c4d38b2..fdb21cb 100644
--- a/lib/properties/backgroundColor.js
+++ b/lib/properties/backgroundColor.js
@@ -22,7 +22,7 @@ module.exports.definition = {
     v = parsers.prepareValue(v, this._global);
     if (parsers.hasVarFunc(v)) {
       this._setProperty("background", "");
-      this._setProperty("backgound-color", v);
+      this._setProperty("background-color", v);
     } else {
       this._setProperty("background-color", module.exports.parse(v));
     }
diff --git a/lib/properties/backgroundImage.js b/lib/properties/backgroundImage.js
index 5c48df9..c99a249 100644
--- a/lib/properties/backgroundImage.js
+++ b/lib/properties/backgroundImage.js
@@ -18,7 +18,7 @@ module.exports.definition = {
     v = parsers.prepareValue(v, this._global);
     if (parsers.hasVarFunc(v)) {
       this._setProperty("background", "");
-      this._setProperty("backgound-image", v);
+      this._setProperty("background-image", v);
     } else {
       this._setProperty("background-image", module.exports.parse(v));
     }
diff --git a/lib/properties/backgroundPosition.js b/lib/properties/backgroundPosition.js
index 14d40f6..80b9452 100644
--- a/lib/properties/backgroundPosition.js
+++ b/lib/properties/backgroundPosition.js
@@ -39,7 +39,7 @@ module.exports.definition = {
     v = parsers.prepareValue(v, this._global);
     if (parsers.hasVarFunc(v)) {
       this._setProperty("background", "");
-      this._setProperty("backgound-position", v);
+      this._setProperty("background-position", v);
     } else {
       this._setProperty("background-position", module.exports.parse(v));
     }
diff --git a/lib/properties/backgroundRepeat.js b/lib/properties/backgroundRepeat.js
index 90c5997..b67b0c0 100644
--- a/lib/properties/backgroundRepeat.js
+++ b/lib/properties/backgroundRepeat.js
@@ -19,7 +19,7 @@ module.exports.definition = {
     v = parsers.prepareValue(v, this._global);
     if (parsers.hasVarFunc(v)) {
       this._setProperty("background", "");
-      this._setProperty("backgound-repeat", v);
+      this._setProperty("background-repeat", v);
     } else {
       this._setProperty("background-repeat", module.exports.parse(v));
     }


Test patch:
diff --git a/test/CSSStyleDeclaration.test.js b/test/CSSStyleDeclaration.test.js
index 67c12e7..10ff564 100644
--- a/test/CSSStyleDeclaration.test.js
+++ b/test/CSSStyleDeclaration.test.js
@@ -1100,3 +1100,17 @@ describe("regression test for https://github.com/jsdom/jsdom/issues/3021", () =>
     assert.strictEqual(style.font, "bold 4px sans-serif");
   });
 });
+
+describe("regression test for https://github.com/jsdom/cssstyle/issues/214", () => {
+  it("should return value for each property", () => {
+    const style = new CSSStyleDeclaration();
+    const key = "background-color";
+    const camel = "backgroundColor";
+    const value = "var(--foo)";
+    style[key] = value;
+    assert.strictEqual(style[key], value);
+    style[key] = null;
+    style[camel] = value;
+    assert.strictEqual(style[camel], value);
+  });
+});