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

Fix: Preview error viewer in platform and IE11 #696

Merged
merged 2 commits into from
Mar 7, 2018

Conversation

tonyjin
Copy link
Contributor

@tonyjin tonyjin commented Mar 2, 2018

  • Contact Us redirect to Box support page should only show up in the Box web application
  • Fix non-wrapping error text in IE11
  • Consolidate download checks into util function
  • Move file-specific util method into file.js

@boxcla
Copy link

boxcla commented Mar 2, 2018

Verified that @tonyjin has signed the CLA. Thanks for the pull request!

src/lib/util.js Outdated
* @return {boolean} Is Preview running in the Box WebApp
*/
export function inBoxWebApp() {
return (window.location.hostname || '').indexOf('app.box.com') !== -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm gonna hold off adding a polyfill for now. The existing polyfill is for Array.prototype.includes. If I included the String polyfill, I'd want to update all references of indexOf and that looks like quite a few files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we follow an isSomething format for boolean returning functions. Maybe isBoxWebApp, or the inverse function isPlatformApp

expect(util.inBoxWebApp()).to.be.false;
});

/* No quick way to stub window.location.hostname to test for truth case */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to SO this works for href, maybe will work for hostname too?

global.window = {
       location: {
           href: {
               value: 'foo'
           }
       }
   }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that thread and wasted ~an hour yesterday trying to get the test to work unsuccessfully. Tried a few things including Object.defineProperty, global.window (which wouldn't work in the browser anyways I think), and a few others.

@tonyjin tonyjin force-pushed the non-downloadable-contact-us branch from 0289230 to 3d1d105 Compare March 2, 2018 22:29
src/lib/util.js Outdated
* @return {boolean} Is Preview running in the Box WebApp
*/
export function inBoxWebApp() {
return (window.location.hostname || '').indexOf('app.box.com') !== -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we follow an isSomething format for boolean returning functions. Maybe isBoxWebApp, or the inverse function isPlatformApp


it('should show not print button if print is not supported', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not show

it('should show print button if print is supported', () => {
stubs.checkFeature.returns(false);

it('should show not print button if file can\'t be downloaded', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not show

- Contact Us redirect to Box support page should only show up in the Box web application
- Fix non-wrapping error text in IE11
- Consolidate download checks into util function
- Move file-specific util method into file.js
@tonyjin tonyjin merged commit cc09a61 into box:master Mar 7, 2018
@tonyjin tonyjin deleted the non-downloadable-contact-us branch March 7, 2018 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants