Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] Fix dotest #1061

Open
aaronreed708 opened this issue Nov 23, 2024 · 3 comments
Open

[SDK] Fix dotest #1061

aaronreed708 opened this issue Nov 23, 2024 · 3 comments
Assignees
Labels
sdk Software development kit

Comments

@aaronreed708
Copy link
Contributor

aaronreed708 commented Nov 23, 2024

Problem/Concern

As we will start running the SDK tests more often as we add changes to the SDK, we need to make sure that they are working correctly.

Currently test/dotest.ts is failing in two places:

  1. assert failing on line 159 because CSSVarGroup listener for ds.organisms.hero is being called 8 times instead of the expected 4 times.
  2. Running the "TEST: BUTTON SELECTION 0" fails during listener notification because the theme's gradient1 and gradient2 don't have "from" values.
    • failing listener is: _tb.cssGenerator.CSSTheme.button

Proposed Solution

Fix the testcase so that it runs to successful completion.

@aaronreed708 aaronreed708 added the sdk Software development kit label Nov 23, 2024
@aaronreed708 aaronreed708 self-assigned this Nov 23, 2024
@aaronreed708
Copy link
Contributor Author

aaronreed708 commented Nov 23, 2024

Debugging exception in notification listener:

Call Stack:
colorTheme.getModeShadeGroups <-- throwing error line 461
colorTheme.getShadeGroups
cssGenerator.shadeGroupListener

12/06/2024 15:04:37.660 DEBUG node code is not enabled because atoms is not initialized
12/06/2024 15:04:37.660 DEBUG node NodeListener: key=atoms/ColorThemes/colorTheme1/Button, begin notifying listeners of event "ValueChanged", listeners=["_tb.cssGenerator.CSSTheme.button","_tb.PropertyGroupListener._tb.cssGenerator.lm-dropdowns","_tb.PropertyGroupListener._tb.cssGenerator.dm-dropdowns","colorTheme"]
12/06/2024 15:04:37.661 DEBUG node NodeListener: key=atoms/ColorThemes/colorTheme1/Button, begin notifying listener _tb.cssGenerator.CSSTheme.button
12/06/2024 15:04:37.661 DEBUG css shadeGroupListener entry: type=button
12/06/2024 15:04:39.892 DEBUG node NodeListener: key=atoms/ColorThemes/colorTheme1/Button, EXCEPTION while notifying listener _tb.cssGenerator.CSSTheme.button
Error: No gradient 1 color has been set
    at ColorTheme.getModeShadeGroups (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/atoms/colorThemes.ts:461:36)
    at ColorTheme.getShadeGroups (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/atoms/colorThemes.ts:451:42)
    at CSSTheme.shadeGroupListener (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/code/cssGenerator.ts:1126:33)
    at /Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/common/node.ts:174:30
    at Array.forEach (<anonymous>)
    at PropertyColorShade.notifyListeners (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/common/node.ts:169:15)
    at PropertyColorShade.sendValueChangeNotification (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/common/props.ts:79:14)
    at PropertyColorShade.setValue (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/src/common/props.ts:65:18)
    at selectColorShade (/Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/test/dotest.ts:294:10)
    at /Users/aaron/git-aaronreed708/a11y-theme-builder-sdk/test/dotest.ts:189:9

aaronreed708 added a commit to aaronreed708/a11y-theme-builder-sdk that referenced this issue Dec 5, 2024
…es are still expected after shadow changes went in
@aaronreed708
Copy link
Contributor Author

aaronreed708 commented Dec 7, 2024

Debugging exception in notification listener:

Call Stack: colorTheme.getModeShadeGroups <-- throwing error line 461 colorTheme.getShadeGroups cssGenerator.shadeGroupListener

So I debugged this yesterday. The exception is because getModeShadeGroups is checking to make sure that all of the requirements/dependencies for building the shade group are in place before it builds the shade group. In this case, the gradient1 and gradient2 values are NOT defined so it is throwing the exception above. These values are not defined because on line 122 of dotest.ts, it calls selectColorPair(ct.lightModeBackground, 2);. When the colorTheme object gets the notification that the background color changed, it will call clearColorDependentProps() which clears out the grandiet, gradientText, button, icon and accent color values. That is how the previously initialized gradient value is wiped out.

So there are two part of dotest that need to change.

  1. I should not be able to set the value of the button until its dependencies are in place. ([SDK] Button and icon do not have registered dependencies #1063)
    • Request to set button value should fail because button is disabled
    • Add Assert that the fact that the button is disabled can be detected
  2. Add to dotest to set the values for the button dependencies and then retry setting the button value and this should now work.

@aaronreed708
Copy link
Contributor Author

This issue is currently blocked by #1063.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk Software development kit
Projects
Status: Blocked
Development

No branches or pull requests

1 participant