1. 13 Nov, 2019 1 commit
  2. 11 Nov, 2019 9 commits
  3. 08 Nov, 2019 4 commits
  4. 06 Nov, 2019 1 commit
  5. 05 Nov, 2019 9 commits
  6. 04 Nov, 2019 5 commits
    • Robert Knight's avatar
      Update mobile testing docs · 6626d65a
      Robert Knight authored
      Update the documentation for testing the client on mobile devices
      following the merge of https://github.com/hypothesis/h/pull/5758.
      
       - Remove the step involving changing the `CLIENT_URL` env var in the h
         dev environment
      
       - Add a Troubleshooting section
      6626d65a
    • Robert Knight's avatar
      Merge pull request #1470 from hypothesis/replace-shallow-with-mount-and-mock · 4916c78c
      Robert Knight authored
      Change approach to mocking components in unit tests
      4916c78c
    • Robert Knight's avatar
    • Robert Knight's avatar
      Change mocking approach for imported components in tests · 147f561c
      Robert Knight authored
      Shallow rendering with Enzyme's `shallow` function conflates two changes in
      rendering behavior:
      
       1. Only rendering "one level deep" so that a test for a component is
          isolated from the details of any child components
      
       2. In React (but not Preact) rendering to a data structure instead of
          real DOM nodes. Even though Preact still renders real DOM nodes,
          Enzyme's shallow rendering API removes many of the features of
          `mount` rendering
      
      In practice, we only used shallow rendering for (1) and we have found
      that there are use cases where we want (1) but still want to be able to
      interact with the real DOM nodes (ie. we don't want (2)). The need to
      use different mocking approaches and understand the conflated behaviors
      mentioned above has been a source of confusion for developers.
      
      This commit changes the mocking approach to always use a pattern that we
      have until now only used selectively. Enzyme's `mount` rendering mode is
      always used, but a utility function, `mockImportedComponents`, is used
      with our existing import mocking (via babel-plugin-mockable-imports) to
      semi-automatically mock all imported components.
      
      Each test has been changed as follows:
      
       1. Replace `shallow` with `mount`
      
       2. Call `ComponentUnderTest.$imports.$mock(mockImportedComponents())`
          in the test setup to mock all imported components, but not helper
          components defined in the same file.
      
       3. Call `ComponentUnderTest.$imports.$restore()` in test cleanup, if
          the test was not already doing that.
      
       4. Replace uses of (`wrapper.find(SomeChildComponent)`) with
          (`wrapper.find('SomeChildComponent')`. This is necessary because the
          mocked component no longer has the same identity as the original, so
          we look it up by name instead.
      147f561c
    • Robert Knight's avatar
      Add a utility to mock all components imported by a module · 721bf3f8
      Robert Knight authored
      This will be used as an alternative to shallow rendering to facilitate
      unit-testing of Preact components.
      721bf3f8
  7. 31 Oct, 2019 1 commit
    • Robert Knight's avatar
      Improve tab bar accessibility · 0c2a785a
      Robert Knight authored
       - Add ARIA roles to the tab bar and individual tabs
       - Make the tab items tab-focusable
       - Indicate the selected tab using `aria-selected`
      0c2a785a
  8. 29 Oct, 2019 5 commits
    • Robert Knight's avatar
      Upgrade Preact · 8c932118
      Robert Knight authored
      This fixes an issue with `useLayoutEffect` where it could run before a
      component's DOM node became connected to the document, preventing the
      effect from measuring the node.
      8c932118
    • Robert Knight's avatar
      Remove unnecessary `$onInit` callback · 9e858939
      Robert Knight authored
      It turns out that `$onChanges` is invoked both when the component is
      initially created as well as subsequent updates. Therefore `$onInit` and
      `$onChanges` duplicated work and components were rendered twice during
      initial creation.
      9e858939
    • Robert Knight's avatar
      Allow function props to be invoked during a digest cycle · 50b0996b
      Robert Knight authored
      Allow function props passed to Preact components wrapped with
      `wrapReactComponent` to be invoked when a digest cycle is already active
      for some reason. In that case using `$scope.$apply` triggers an error.
      
      This scenario is rare, as callbacks are usually invoked in response to
      events that happen outside of Angular, but changes made by Angular code
      can indirectly cause Preact components to invoke callbacks. For example,
      in layout effects which run at the end of a `render` call.
      50b0996b
    • Robert Knight's avatar
      Make boot URL templating work in IE 11 / early Edge · 863dc558
      Robert Knight authored
      Make the boot URL templating used during development work in IE 11 and
      Edge. In IE 11 `document.currentScript` is not available and in IE 11 /
      early Edge, the `URL` constructor is not available before polyfills have
      been loaded.
      
      The `document.currentScript` fallback here assumes that the boot script
      has been loaded synchronously so that the boot script is the last
      `<script>` element on the page at the point when it runs.
      
      Also add a fast path for production builds where URLs do not contain
      template params.
      
      This is a follow up to #1441
      863dc558
    • Robert Knight's avatar
      Merge pull request #1449 from hypothesis/fix-pdf-position-anchoring-bug · 1c80ed66
      Robert Knight authored
      Fix PDF anchoring when annotation refers to last text on a page
      1c80ed66
  9. 28 Oct, 2019 5 commits