Skip to content

Commit

Permalink
refactor(transfer): align with select & monorepo structure
Browse files Browse the repository at this point in the history
Fixes #50

This commit does several things:

* Use strings as selected values
* Use strings to store which options are highlighted
* Removes jest test abstractions
* Simplifies internal names
* Replaces common.js files with files whose names match their content
* Moves the Transfer component from core to widgets
* Adds the .js extension to all import statements where applicable
* Provides the correct disabled & dataTest props to the re-order up
* button's icon

BREAKING CHANGE: The Transfer component now expects options to be passed in as objects, not as children. Custom components can be provided via the optionComponent prop for all options or via the component property on an individual option.

BREAKING CHANGE: The Transfer component now expects strings as selected
values instead of option objects.

BREAKING CHANGE: The Transfer component is now part of widgets
  • Loading branch information
Mohammer5 authored May 28, 2020
2 parents 67d8d15 + 53a2e81 commit c15477d
Show file tree
Hide file tree
Showing 110 changed files with 1,505 additions and 2,291 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/src/locales/*
**/cypress/assets
**/src/locales/*
12 changes: 3 additions & 9 deletions cypress/integration/Transfer/display-order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ When('the user selects multiple options', () => {
})
.each($option => cy.wrap($option).clickWith('ctrl'))
.then($options => {
cy.wrap($options.toArray().map(extractOptionFromElement))
.as('selectedOptions')
.then(console.log.bind(null, 'selectedOptions'))
cy.wrap($options.toArray().map(extractOptionFromElement)).as(
'selectedOptions'
)
})

cy.get('{transfer-actions-addindividual}').click()
Expand Down Expand Up @@ -150,7 +150,6 @@ Then(
() => cy.get('{transfer-sourceoptions} {transferoption}'),
() => cy.get('@deselectedOptions')
).should(([win, $selectableSourceOptions, deselectedOptions]) => {
console.log('deselectedOptions', deselectedOptions)
const selectableSourceOptions = $selectableSourceOptions
.toArray()
.map(extractOptionFromElement)
Expand All @@ -169,9 +168,6 @@ Then(
value === deselectedOption.value
)

if (!result) {
console.log('deselectedOption', deselectedOption)
}
return result
})
expect(hasAllOptions).to.equal(true)
Expand Down Expand Up @@ -205,8 +201,6 @@ Then(
.slice(transferredOptions.length * -1)
.map(extractOptionFromElement)

console.log('transferredOptions', transferredOptions)
console.log('lastSelectedOptions', lastSelectedOptions)
expect(transferredOptions).to.eql(lastSelectedOptions)
})
}
Expand Down
40 changes: 0 additions & 40 deletions packages/core/src/Transfer/Filter.js

This file was deleted.

59 changes: 0 additions & 59 deletions packages/core/src/Transfer/PickedOptions.js

This file was deleted.

60 changes: 0 additions & 60 deletions packages/core/src/Transfer/SourceOptions.js

This file was deleted.

140 changes: 0 additions & 140 deletions packages/core/src/Transfer/__e2e__/common.js

This file was deleted.

32 changes: 0 additions & 32 deletions packages/core/src/Transfer/__e2e__/display-order.stories.e2e.js

This file was deleted.

Loading

0 comments on commit c15477d

Please sign in to comment.