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

CC-1296 Ensure tooltip is not affected by stylistic changes from button being disabled #1886

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions app/components/settings/profile-page/username-section.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<EmberTooltip @text="This value is synced with your GitHub account. Click on the refresh button below to update your username." />
{{/if}}
</div>

<div class="text-gray-400 text-xs mt-1">
{{#if @user.hasAnonymousModeEnabled}}
Your profile has anonymous mode enabled. Your GitHub username is not visible to others.
Expand All @@ -22,21 +23,23 @@
{{/if}}
</div>

<TertiaryButtonWithSpinner
@size="extra-small"
class="mt-4"
@shouldShowSpinner={{this.isSyncingUsernameFromGitHub}}
@isDisabled={{this.currentUser.hasAnonymousModeEnabled}}
{{on "click" this.refreshFromGitHub}}
data-test-refresh-from-github-button
>
<div class="flex items-center gap-1">
{{svg-jar "refresh" class="w-4 h-4 text-gray-400"}}
Refresh from GitHub
</div>
<div>
<TertiaryButtonWithSpinner
@size="extra-small"
class="mt-4"
@shouldShowSpinner={{this.isSyncingUsernameFromGitHub}}
@isDisabled={{this.currentUser.hasAnonymousModeEnabled}}
{{on "click" this.refreshFromGitHub}}
data-test-refresh-from-github-button
>
<div class="flex items-center gap-1">
{{svg-jar "refresh" class="w-4 h-4 text-gray-400"}}
Refresh from GitHub
</div>
</TertiaryButtonWithSpinner>

{{#if this.currentUser.hasAnonymousModeEnabled}}
<EmberTooltip @text="Your profile has anonymous mode enabled. Your GitHub username is not visible to others." />
{{/if}}
</TertiaryButtonWithSpinner>
</div>
</Settings::FormSection>
7 changes: 7 additions & 0 deletions tests/acceptance/settings-page/profile-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import profilePage from 'codecrafters-frontend/tests/pages/settings/profile-page';
import userPage from 'codecrafters-frontend/tests/pages/user-page';
import testScenario from 'codecrafters-frontend/mirage/scenarios/test';
import { assertTooltipContent } from 'ember-tooltips/test-support';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'codecrafters-frontend/tests/helpers';
import { signIn, signInAsSubscriber } from 'codecrafters-frontend/tests/support/authentication-helpers';
Expand Down Expand Up @@ -74,6 +75,12 @@ module('Acceptance | settings-page | profile-test', function (hooks) {
assert.strictEqual(userPage.githubDetails.username, 'Anonymous');

await profilePage.visit();
await profilePage.refreshFromGitHubButton.hover();

assertTooltipContent(assert, {
contentString: 'Your profile has anonymous mode enabled. Your GitHub username is not visible to others.',
});

await profilePage.refreshFromGitHubButton.click();
await profilePage.accountDropdown.toggle();
await profilePage.accountDropdown.clickOnLink('Your Profile');
Expand Down
1 change: 1 addition & 0 deletions tests/pages/settings/profile-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default createPage({
},

refreshFromGitHubButton: {
hover: triggerable('mouseenter'),
scope: '[data-test-refresh-from-github-button]',
},

Expand Down
Loading