Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
67 changes: 67 additions & 0 deletions __tests__/html2/activity/feedback.noForm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
<script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
<script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<main id="webchat"></main>
<script type="text/babel">
run(async function () {
const {
React,
ReactDOM: { render },
WebChat: { ReactWebChat }
} = window; // Imports in UMD fashion.

const { directLine, store } = testHelpers.createDirectLineEmulator();

const App = () => (
<React.Fragment>
<ReactWebChat
directLine={directLine}
store={store}
/>
</React.Fragment>
);

render(<App />, document.getElementById('webchat'));

await pageConditions.uiConnected();

await directLine.emulateIncomingActivity({
type: 'message',
id: 'a-00001',
timestamp: 0,
text: 'This is a a test message without a disclaimer',
from: {
role: 'bot'
},
locale: 'en-US',
entities: [],
channelData: {
feedbackLoop: {
type: 'default'
}
}
});

pageElements.byTestId('send box text area').focus();
await host.sendShiftTab(3);

await host.sendKeys('ENTER');
await host.sendKeys('ENTER');


await expect(pageElements.byTestId('feedback sendbox')).toBeFalsy();

await host.snapshot('local');
});
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import dereferenceBlankNodes from '../../Utils/JSONLinkedData/dereferenceBlankNo
import hasFeedbackLoop from '../private/hasFeedbackLoop';
import ActivityFeedbackContext, { type ActivityFeedbackContextType } from './private/ActivityFeedbackContext';

const { usePonyfill, usePostActivity } = hooks;
const { usePonyfill, usePostActivity, useStyleOptions } = hooks;

type ActivityFeedbackComposerProps = Readonly<{
activity: WebChatActivity;
Expand Down Expand Up @@ -188,7 +188,9 @@ function ActivityFeedbackComposer({ children, activity: activityFromProps }: Act
[actionsRef, actionStateRef, activityRef, postActivity, setActionStateWithRefresh]
);

const shouldShowFeedbackForm = hasFeedbackLoop(activity);
const [{ feedbackActionsPlacement }] = useStyleOptions();

const shouldShowFeedbackForm = hasFeedbackLoop(activity) && feedbackActionsPlacement === 'activity-actions';
const shouldShowFeedbackFormRef = useRefFrom(shouldShowFeedbackForm);

const shouldShowFeedbackFormState = useMemo<readonly [boolean]>(
Expand Down
Loading