Skip to content

Commit bd012f3

Browse files
committed
Fixes panel attention % not being shown
Resolves brave/brave-browser#8463
1 parent 3064c8e commit bd012f3

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

components/brave_rewards/browser/rewards_service_browsertest.cc

+27
Original file line numberDiff line numberDiff line change
@@ -3033,3 +3033,30 @@ IN_PROC_BROWSER_TEST_F(BraveRewardsBrowserTest, ShowMonthlyIfACOff) {
30333033

30343034
WaitForSelector(popup_contents, "#panel-donate-monthly");
30353035
}
3036+
3037+
IN_PROC_BROWSER_TEST_F(BraveRewardsBrowserTest, ShowACPercentInThePanel) {
3038+
EnableRewards();
3039+
3040+
VisitPublisher("3zsistemi.si", true);
3041+
3042+
GURL url = https_server()->GetURL("3zsistemi.si", "/");
3043+
ui_test_utils::NavigateToURLWithDisposition(
3044+
browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB,
3045+
ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP);
3046+
3047+
// Open the Rewards popup
3048+
content::WebContents *popup_contents = OpenRewardsPopup();
3049+
ASSERT_TRUE(popup_contents);
3050+
3051+
{
3052+
content::EvalJsResult js_result = EvalJs(
3053+
popup_contents,
3054+
"const delay = t => new Promise(resolve => setTimeout(resolve, t));"
3055+
"delay(0).then(() => "
3056+
" document.querySelector(\"[data-test-id='attention-score']\")"
3057+
" .innerHTML);",
3058+
content::EXECUTE_SCRIPT_DEFAULT_OPTIONS,
3059+
content::ISOLATED_WORLD_ID_CONTENT_END);
3060+
EXPECT_NE(js_result.ExtractString().find("100%"), std::string::npos);
3061+
}
3062+
}

components/brave_rewards/resources/ui/components/walletPanel/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ export default class WalletPanel extends React.PureComponent<Props, {}> {
222222
</StyledAttentionScoreTitle>
223223
</StyledColumn>
224224
<StyledColumn size={'1'}>
225-
<StyledAttentionScore>{attentionScore}%</StyledAttentionScore>
225+
<StyledAttentionScore data-test-id={'attention-score'}>
226+
{attentionScore}%
227+
</StyledAttentionScore>
226228
</StyledColumn>
227229
</StyledGrid>
228230
</StyledScoreWrapper>

vendor/bat-native-ledger/src/bat/ledger/internal/database/database_publisher_info.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ void DatabasePublisherInfo::GetPanelRecord(
323323

324324
transaction->commands.push_back(std::move(command));
325325

326-
auto transaction_callback = std::bind(&DatabasePublisherInfo::OnGetRecord,
326+
auto transaction_callback = std::bind(
327+
&DatabasePublisherInfo::OnGetPanelRecord,
327328
this,
328329
_1,
329330
callback);

0 commit comments

Comments
 (0)