├── .nvmrc ├── .gitignore ├── src ├── index.js ├── components │ └── Fretboard │ │ ├── Skins │ │ ├── BoardGraphicBoxes │ │ │ ├── index.js │ │ │ └── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ └── index.test.js.snap │ │ │ │ └── index.test.js │ │ ├── FretWrapper.js │ │ ├── NutGraphicBoxes │ │ │ ├── __tests__ │ │ │ │ ├── index.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ └── index.js │ │ ├── NutGraphicStrings │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ │ └── index.test.js │ │ │ └── index.js │ │ ├── BoardGraphicStrings │ │ │ ├── __tests__ │ │ │ │ ├── index.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ └── index.js │ │ ├── __tests__ │ │ │ ├── skins.test.js │ │ │ ├── fretWrapperBoxes.test.js │ │ │ ├── fretWrapperStrings.test.js │ │ │ └── __snapshots__ │ │ │ │ ├── fretWrapperStrings.test.js.snap │ │ │ │ └── fretWrapperBoxes.test.js.snap │ │ ├── FretWrapperBoxes.js │ │ ├── FretWrapperStrings.js │ │ └── skins.js │ │ ├── PositionLabels │ │ ├── Wrapper.js │ │ ├── FretLabels.js │ │ ├── __tests__ │ │ │ ├── __snapshots__ │ │ │ │ ├── fretLabels.js.snap │ │ │ │ ├── label.test.js.snap │ │ │ │ └── index.test.js.snap │ │ │ ├── fretLabels.js │ │ │ ├── index.test.js │ │ │ └── label.test.js │ │ ├── Label.js │ │ └── index.js │ │ ├── Neck │ │ ├── ViewPortMain │ │ │ ├── Wrapper.js │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── wrapper.test.js.snap │ │ │ │ │ └── index.test.js.snap │ │ │ │ ├── index.test.js │ │ │ │ └── wrapper.test.js │ │ │ └── index.js │ │ ├── Board │ │ │ ├── BoardPositions │ │ │ │ ├── Wrapper.js │ │ │ │ ├── __tests__ │ │ │ │ │ ├── index.test.js │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ └── index.test.js.snap │ │ │ │ └── index.js │ │ │ ├── __tests__ │ │ │ │ ├── index.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ └── index.js │ │ ├── Position │ │ │ ├── Wrapper.js │ │ │ ├── Fret │ │ │ │ ├── Content │ │ │ │ │ ├── NoteContent │ │ │ │ │ │ ├── AccWrapper.js │ │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ │ │ ├── accWrapper.test.js.snap │ │ │ │ │ │ │ │ └── index.test.js.snap │ │ │ │ │ │ │ ├── accWrapper.test.js │ │ │ │ │ │ │ └── index.test.js │ │ │ │ │ │ ├── Readme.md │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── Wrapper.js │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ │ ├── wrapper.test.js.snap │ │ │ │ │ │ │ └── index.test.js.snap │ │ │ │ │ │ ├── wrapper.test.js │ │ │ │ │ │ └── index.test.js │ │ │ │ │ └── index.js │ │ │ │ ├── Wrapper.js │ │ │ │ ├── __tests__ │ │ │ │ │ ├── wrapper.test.js │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ ├── wrapper.test.js.snap │ │ │ │ │ │ └── index.test.js.snap │ │ │ │ │ └── index.test.js │ │ │ │ ├── Readme.md │ │ │ │ └── index.js │ │ │ ├── __tests__ │ │ │ │ ├── wrapper.test.js │ │ │ │ ├── index.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ ├── wrapper.test.js.snap │ │ │ │ │ └── index.test.js.snap │ │ │ └── index.js │ │ ├── ViewPort │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ │ └── index.test.js │ │ │ └── index.js │ │ ├── Nut │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ │ └── index.test.js │ │ │ └── index.js │ │ ├── OpenPosition │ │ │ ├── __tests__ │ │ │ │ ├── index.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── index.test.js.snap │ │ │ └── index.js │ │ ├── __tests__ │ │ │ ├── index.test.js │ │ │ └── __snapshots__ │ │ │ │ └── index.test.js.snap │ │ └── index.js │ │ ├── Wrapper.js │ │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── wrapper.test.js.snap │ │ │ └── index.test.js.snap │ │ ├── wrapper.test.js │ │ └── index.test.js │ │ ├── Readme.md │ │ └── index.js ├── themes │ ├── __tests__ │ │ ├── fretboard-theme.test.js │ │ └── __snapshots__ │ │ │ └── fretboard-theme.test.js.snap │ └── fretboard-theme.js ├── lib │ ├── __tests__ │ │ ├── tonal-helpers.test.js │ │ ├── fret.test.js │ │ ├── __snapshots__ │ │ │ └── selection.test.js.snap │ │ ├── fretboard.test.js │ │ └── selection.test.js │ ├── shapes.js │ ├── tonal-helpers.js │ ├── fretboard.js │ ├── fret.js │ └── selection.js └── styleguide │ ├── ThemeWrapper.js │ ├── ContextProvider │ └── index.js │ └── fixtures.js ├── config └── jestsetup.js ├── .babelrc ├── styleguide.config.js ├── .jestrc.json ├── webpack.config.js ├── .eslintrc ├── package.json └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | v8.6.0 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | coverage 5 | npm-debug.log 6 | yarn-error.log 7 | stats.json 8 | 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export { 2 | intervalNotes, 3 | chordNotes, 4 | scaleNotes, 5 | } from 'lib/selection' 6 | export { default } from 'components/Fretboard' 7 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/BoardGraphicBoxes/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | 4 | const BoardGraphicBoxes = () => () 5 | 6 | 7 | export default BoardGraphicBoxes 8 | -------------------------------------------------------------------------------- /src/themes/__tests__/fretboard-theme.test.js: -------------------------------------------------------------------------------- 1 | import theme from '../fretboard-theme' 2 | 3 | 4 | it('should check fretboard-theme against snapshot', () => { 5 | expect(theme).toMatchSnapshot() 6 | }) 7 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | display: flex; 5 | ` 6 | 7 | /** @component */ 8 | export default Wrapper 9 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/BoardGraphicBoxes/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`BoardGraphicBoxes component, snapshot 1`] = ``; 4 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPortMain/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | height: ${props => props.height}px; 5 | ` 6 | 7 | /** @component */ 8 | export default Wrapper 9 | -------------------------------------------------------------------------------- /src/components/Fretboard/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | width: 100%; 5 | background-color: ${props => props.theme.background}; 6 | ` 7 | 8 | /** @component */ 9 | export default Wrapper 10 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/FretLabels.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const FretLabels = styled.div` 4 | display: flex; 5 | width: ${props => props.width}%; 6 | ` 7 | 8 | /** @component */ 9 | export default FretLabels 10 | -------------------------------------------------------------------------------- /src/components/Fretboard/__tests__/__snapshots__/wrapper.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return wrapper with correct width 1`] = ` 4 | .c0 { 5 | width: 100%; 6 | } 7 | 8 |
11 | `; 12 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Board/BoardPositions/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const PositionWrapper = styled.div` 4 | display: flex; 5 | width: 100%; 6 | height: 100%; 7 | ` 8 | 9 | /** @component */ 10 | export default PositionWrapper 11 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/FretWrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | 4 | const FretWrapper = styled.div` 5 | display: flex; 6 | justify-content: center; 7 | align-items: center; 8 | ` 9 | 10 | /** @component */ 11 | export default FretWrapper 12 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | display: flex; 5 | flex-flow: column; 6 | height: 100%; 7 | width: ${props => props.width}%; 8 | ` 9 | 10 | /** @component */ 11 | export default Wrapper 12 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPort/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ViewPort component, snapshot 1`] = ` 4 | 10 | 11 | 12 | `; 13 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPortMain/__tests__/__snapshots__/wrapper.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return wrapper with correct width 1`] = ` 4 | .c0 { 5 | height: 40px; 6 | } 7 | 8 |
12 | `; 13 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Nut/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Nut component, snapshot 1`] = ` 4 | 8 | 11 | 12 | `; 13 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPortMain/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import ViewPort from '../index' 4 | 5 | 6 | it('ViewPort component, snapshot', () => { 7 | const wrapper = shallow() 8 | expect(wrapper).toMatchSnapshot() 9 | }) 10 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/NutGraphicBoxes/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import NutGraphicBoxes from '../index' 4 | 5 | 6 | it('NutGraphicBoxes component, snapshot', () => { 7 | const wrapper = shallow() 8 | expect(wrapper).toMatchSnapshot() 9 | }) 10 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/BoardGraphicBoxes/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import BoardGraphicBoxes from '../index' 4 | 5 | 6 | it('BoardGraphicBoxes component, snapshot', () => { 7 | const wrapper = shallow() 8 | expect(wrapper).toMatchSnapshot() 9 | }) 10 | -------------------------------------------------------------------------------- /src/components/Fretboard/__tests__/wrapper.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import 'jest-styled-components' 4 | 5 | import Wrapper from '../Wrapper' 6 | 7 | 8 | it('should return wrapper with correct width', () => { 9 | const wrapper = shallow() 10 | expect(wrapper).toMatchSnapshot() 11 | }) 12 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Content/NoteContent/AccWrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const AccWrapper = styled.span` 4 | text-align: center; 5 | vertical-align: top; 6 | font-size: ${props => (props.theme.fontSize - 3)}px; 7 | overflow: hidden; 8 | ` 9 | 10 | export default AccWrapper 11 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/NutGraphicStrings/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`NutGraphicStrings component, snapshot 1`] = ` 4 | 11 | `; 12 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/NutGraphicBoxes/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | 4 | const NutGraphicBoxes = () => 5 | 15 | 16 | 17 | export default NutGraphicBoxes 18 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPort/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import ViewPort from '../index' 4 | 5 | const props = { 6 | width: 10, 7 | offset: 10, 8 | } 9 | 10 | it('ViewPort component, snapshot', () => { 11 | const wrapper = shallow() 12 | expect(wrapper).toMatchSnapshot() 13 | }) 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/NutGraphicBoxes/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`NutGraphicBoxes component, snapshot 1`] = ` 4 | 14 | `; 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Content/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | text-align: center; 5 | vertical-align: middle; 6 | font-size: ${props => props.theme.fontSize}px; 7 | overflow-x: hidden; 8 | text-overflow: clip; 9 | ` 10 | 11 | /** @component */ 12 | export default Wrapper 13 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Wrapper.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Wrapper = styled.div` 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | width: 100%; 8 | height: 100%; 9 | ${props => props.isClickable && 'cursor: pointer;'} 10 | ` 11 | 12 | /** @component */ 13 | export default Wrapper 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/NutGraphicStrings/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import NutGraphicStrings from '../index' 4 | 5 | const props = { 6 | nrOfStrings: 6, 7 | } 8 | 9 | it('NutGraphicStrings component, snapshot', () => { 10 | const wrapper = shallow() 11 | expect(wrapper).toMatchSnapshot() 12 | }) 13 | -------------------------------------------------------------------------------- /config/jestsetup.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | import 'babel-polyfill' 3 | import 'raf/polyfill' 4 | 5 | import { shallow, render, mount, configure } from 'enzyme' 6 | import Adapter from 'enzyme-adapter-react-16' 7 | 8 | configure({ adapter: new Adapter() }) 9 | 10 | global.shallow = shallow 11 | global.render = render 12 | global.mount = mount 13 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "transform-object-rest-spread" 4 | ], 5 | "env": { 6 | "production": { 7 | "presets": [ 8 | ["env", { "modules": false }], 9 | "react" 10 | ] 11 | }, 12 | "development": { 13 | "presets": ["env", "react"] 14 | }, 15 | "test": { 16 | "presets": ["env", "react"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/__tests__/wrapper.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import 'jest-styled-components' 3 | 4 | import Wrapper from '../Wrapper' 5 | 6 | const props = { 7 | width: 10, 8 | } 9 | 10 | it('should return wrapper with correct width', () => { 11 | const wrapper = shallow() 12 | expect(wrapper).toMatchSnapshot() 13 | }) 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Content/NoteContent/__tests__/__snapshots__/accWrapper.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return wrapper with correct font size 1`] = ` 4 | .c0 { 5 | text-align: center; 6 | vertical-align: top; 7 | font-size: 9px; 8 | overflow: hidden; 9 | } 10 | 11 | 14 | `; 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/ViewPortMain/__tests__/wrapper.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import 'jest-styled-components' 4 | 5 | import Wrapper from '../Wrapper' 6 | 7 | const props = { 8 | height: 40, 9 | } 10 | 11 | it('should return wrapper with correct width', () => { 12 | const wrapper = shallow() 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/__tests__/__snapshots__/fretLabels.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return FretLabels snapshot 1`] = ` 4 | .c0 { 5 | display: -webkit-box; 6 | display: -webkit-flex; 7 | display: -ms-flexbox; 8 | display: flex; 9 | width: 10%; 10 | } 11 | 12 |
16 | `; 17 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import Position from '../index' 4 | 5 | const props = { 6 | tuning: ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'], 7 | width: 12, 8 | pos: 5, 9 | } 10 | 11 | it('Position component, snapshot', () => { 12 | const wrapper = shallow() 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Content/__tests__/__snapshots__/wrapper.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return wrapper with correct width 1`] = ` 4 | .c0 { 5 | text-align: center; 6 | vertical-align: middle; 7 | font-size: 12px; 8 | overflow-x: hidden; 9 | text-overflow: clip; 10 | } 11 | 12 |
15 | `; 16 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/__tests__/fretLabels.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import 'jest-styled-components' 3 | 4 | import FretLabels from '../FretLabels' 5 | 6 | const defaultProps = { 7 | width: 10, 8 | } 9 | 10 | it('should return FretLabels snapshot', () => { 11 | const wrapper = shallow() 12 | 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/BoardGraphicStrings/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import BoardGraphicStrings from '../index' 4 | 5 | const props = { 6 | nrOfStrings: 6, 7 | nrOfFrets: 12, 8 | } 9 | 10 | it('BoardGraphicStrings component, snapshot', () => { 11 | const wrapper = shallow() 12 | expect(wrapper).toMatchSnapshot() 13 | }) 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/OpenPosition/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import OpenPosition from '../index' 4 | 5 | const props = { 6 | tuning: ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'], 7 | width: 10, 8 | } 9 | 10 | it('OpenPosition component, snapshot', () => { 11 | const wrapper = shallow() 12 | 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | 16 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Board/BoardPositions/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import BoardPositions from '../index' 4 | 5 | const props = { 6 | tuning: ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'], 7 | nrOfFrets: 12, 8 | } 9 | 10 | it('BoardPositions component, snapshot', () => { 11 | const wrapper = shallow() 12 | expect(wrapper).toMatchSnapshot() 13 | }) 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Nut/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import Nut from '../index' 4 | 5 | const props = { 6 | tuning: ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'], 7 | skinType: 'boxes', 8 | width: 5, 9 | offset: 10, 10 | } 11 | 12 | it('Nut component, snapshot', () => { 13 | const wrapper = shallow() 14 | 15 | expect(wrapper).toMatchSnapshot() 16 | }) 17 | 18 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/Label.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | const Label = styled.div` 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | height: ${props => props.theme.dimensions.stringHeight}px; 8 | width: ${props => props.width}%; 9 | font-size: ${props => props.theme.fontSize}px; 10 | ` 11 | 12 | /** @component */ 13 | export default Label 14 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import PositionLabels from '../index' 4 | 5 | const defaultProps = { 6 | nutWidth: 1, 7 | openWidth: 10, 8 | nrOfFrets: 12, 9 | } 10 | 11 | it('should return PositionLabels snapshot', () => { 12 | const wrapper = shallow() 13 | 14 | expect(wrapper).toMatchSnapshot() 15 | }) 16 | -------------------------------------------------------------------------------- /src/lib/__tests__/tonal-helpers.test.js: -------------------------------------------------------------------------------- 1 | import { transpose, isEqual } from '../tonal-helpers' 2 | 3 | it('should transpose by semitones', () => { 4 | expect(transpose('E2')(5)).toBe('A2') 5 | }) 6 | 7 | it('should match pitches and pcs', () => { 8 | const isEqualE2 = isEqual('E2') 9 | expect(isEqualE2('E2')).toBe(true) 10 | expect(isEqualE2('E3')).toBe(false) 11 | expect(isEqualE2('E')).toBe(true) 12 | }) 13 | -------------------------------------------------------------------------------- /src/components/Fretboard/Skins/__tests__/skins.test.js: -------------------------------------------------------------------------------- 1 | import { 2 | boardGraphic, 3 | // nutGraphic, 4 | fretWrapper, 5 | } from '../skins' 6 | 7 | describe('skins module', () => { 8 | it('boardGraphic', () => { 9 | expect(boardGraphic('strings').name).toBe('BoardGraphicStrings') 10 | }) 11 | 12 | it('fretWrapper', () => { 13 | expect(fretWrapper('strings').name).toBe('StyledComponent') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /src/components/Fretboard/Neck/Position/Fret/Content/__tests__/wrapper.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import theme from 'themes/fretboard-theme' 3 | import 'jest-styled-components' 4 | 5 | import Wrapper from '../Wrapper' 6 | 7 | const props = { 8 | theme, 9 | } 10 | 11 | it('should return wrapper with correct width', () => { 12 | const wrapper = shallow() 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | -------------------------------------------------------------------------------- /src/components/Fretboard/PositionLabels/__tests__/label.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import 'jest-styled-components' 3 | import theme from 'themes/fretboard-theme' 4 | 5 | import Label from '../Label' 6 | 7 | const defaultProps = { 8 | width: 10, 9 | theme, 10 | } 11 | 12 | it('should return Label snapshot', () => { 13 | const wrapper = shallow(