microsoft / surface-duo-compose-sdk

This repo contains components built with Jetpack Compose for the Microsoft Surface Duo.
MIT License
74 stars 2 forks source link

Add callbacks for pane mode switches and test scope instances #34

Closed khalp closed 2 years ago

khalp commented 2 years ago

πŸ“ƒ Description

This PR adds two main features:

  1. Two new parameters for methods that will be called when spanning/unspanning
  2. Test scope instances for use in UI tests

Both samples were updated to use the new features in the apps/tests:

πŸ€” Motivation and Context

This will make it easier for developers to maintain the desired state when switching between single and two pane mode (ex: if displaying list-detail in two panes, making sure that the single pane view will show the selected detail view when unspanning). This will also make it easier for developers to test any composables that use TwoPaneScope or TwoPaneNavScope.

πŸ§ͺ How Has This Been Tested?

Tested manually on the device, and the new sample tests were run.

βš’οΈ Does the PR contain new tests or refactored old ones?

It contains both - had to refactor one of the nav_sample tests because we're not using HorizontalSingle mode anymore, and also had to add new tests to show how to use the test scope instances.

πŸ“· Screenshots (if appropriate)

πŸ“¦ Types of changes

βœ… Checklist

joyl1216 commented 2 years ago

Excellent job! The new feature looks awesome. Let's highlight it at the beginning of the README and ship it!