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

test nested iframe params #2511

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
10 changes: 7 additions & 3 deletions apps/teams-test-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ if (
} else {
if (isTestBackCompat()) {
appInitialization.notifyAppLoaded();
appInitialization.notifySuccess();
if (!urlParams.has('noSuccess') || urlParams.get('noSuccess') !== 'true') {
appInitialization.notifySuccess();
}
} else {
app.notifyAppLoaded();
app.notifySuccess();
// app.notifyAppLoaded();
if (!urlParams.has('noSuccess') || urlParams.get('noSuccess') !== 'true') {
app.notifySuccess();
}
}
}

Expand Down
18 changes: 17 additions & 1 deletion apps/teams-test-app/src/pages/TestApp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IAppWindow } from '@microsoft/teams-js';
import React from 'react';
import React, { useEffect, useState } from 'react';

import AppAPIs from '../components/AppAPIs';
import AppEntityAPIs from '../components/AppEntityAPIs';
Expand Down Expand Up @@ -68,12 +68,28 @@ import WebStorageAPIs from '../components/WebStorageAPIs';

export const TestApp: React.FC = () => {
const dialogWindowRef = React.useRef<IAppWindow | null>(null);
const [shouldNest, setShouldNest] = useState(false);

useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
setShouldNest(urlParams.get('shouldNest') === 'true');
}, []);

return (
<>
<button id="button_reload" onClick={() => window.location.reload()}>
Reload This App
</button>
{shouldNest && (
<iframe
src="https://localhost:3001/?noSuccess=true"
width="500px"
height="500px"
style={{ border: 'none' }}
title="Embedded Content"
sandbox="allow-scripts"
/>
)}
<div className="App-container">
<AppAPIs />
<AppInitializationAPIs />
Expand Down