forked from capability-boosters-dev/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create page for displaying past announcements
Test plan: -“Global Announcements” link is working in the account navigation -page is populated with dismissed/past/current announcements Fixes KNO-482 flag=past_announcements Change-Id: I2b06247816254264a44bdb4b0a634503542851f4 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/237606 Reviewed-by: Rob Orton <[email protected]> Tested-by: Service Cloud Jenkins <[email protected]> QA-Review: Rob Orton <[email protected]> Product-Review: Rob Orton <[email protected]>
- Loading branch information
1 parent
7ade3ba
commit faceb66
Showing
8 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (C) 2020 - present Instructure, Inc. | ||
* | ||
* This file is part of Canvas. | ||
* | ||
* Canvas is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License as published by the Free | ||
* Software Foundation, version 3 of the License. | ||
* | ||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import $ from 'jquery' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import PastGlobalAnnouncements from '../past_global_announcements/PastGlobalAnnouncements' | ||
|
||
$(() => { | ||
ReactDOM.render(<PastGlobalAnnouncements />, $('<div/>').appendTo('#content')[0]) | ||
}) |
38 changes: 38 additions & 0 deletions
38
app/jsx/past_global_announcements/PastGlobalAnnouncements.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (C) 2020 - present Instructure, Inc. | ||
* | ||
* This file is part of Canvas. | ||
* | ||
* Canvas is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License as published by the Free | ||
* Software Foundation, version 3 of the License. | ||
* | ||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react' | ||
import {Heading} from '@instructure/ui-heading/lib/Heading' | ||
|
||
const PastGlobalAnnouncements = () => { | ||
return ( | ||
<> | ||
<Heading border="bottom" margin="medium"> | ||
Current | ||
</Heading> | ||
<div dangerouslySetInnerHTML={{__html: ENV.global_notifications.active}}/> | ||
|
||
<Heading border="bottom" margin="medium"> | ||
Past | ||
</Heading> | ||
<div dangerouslySetInnerHTML={{__html: ENV.global_notifications.past}}/> | ||
</> | ||
) | ||
} | ||
|
||
export default PastGlobalAnnouncements |
40 changes: 40 additions & 0 deletions
40
app/jsx/past_global_announcements/__tests__/pastGlobalAnnouncements.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2020 - present Instructure, Inc. | ||
* | ||
* This file is part of Canvas. | ||
* | ||
* Canvas is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License as published by the Free | ||
* Software Foundation, version 3 of the License. | ||
* | ||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import PastGlobalAnnouncements from '../PastGlobalAnnouncements' | ||
import {render} from '@testing-library/react' | ||
import React from 'react' | ||
|
||
describe('render announcements', () => { | ||
beforeAll(() => { | ||
window.ENV.global_notifications = { | ||
active: '<div><p>This is an active announcement</p></div>', | ||
past: '<div><p>This is a past announcement</p></div>' | ||
} | ||
}) | ||
|
||
it('checks that the document contains active announcements', () => { | ||
const {getByText} = render(<PastGlobalAnnouncements/>) | ||
expect(getByText('This is an active announcement')).toBeVisible() | ||
}) | ||
|
||
it('checks that the document contains past announcements', () => { | ||
const {getByText} = render(<PastGlobalAnnouncements/>) | ||
expect(getByText('This is a past announcement')).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters