-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import MasterCSS from '../src' | ||
|
||
test('states', () => { | ||
const css = new MasterCSS() | ||
expect(css.create('font:12:hover[disabled]@sm')[0].stateToken).toBe(':hover[disabled]@sm') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/eslint-plugin/lib/utils/are-declarations-equal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function areDeclarationsEqual(aDeclarations, bDeclarations) { | ||
// 获取对象A和B的所有属性名 | ||
const aKeys = Object.keys(aDeclarations); | ||
const bKeys = Object.keys(bDeclarations); | ||
|
||
// 如果属性数量不相等,返回false | ||
if (aKeys.length !== bKeys.length) { | ||
return false; | ||
} | ||
|
||
// 检查对象A的属性是否都存在于对象B中 | ||
for (const key of aKeys) { | ||
if (!bDeclarations.hasOwnProperty(key)) { | ||
return false; | ||
} | ||
} | ||
|
||
// 如果所有属性都匹配,返回true | ||
return true; | ||
} | ||
|
||
module.exports = areDeclarationsEqual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters