import { GraphicalMeasure } from "../../../../src/MusicalScore/Graphical/GraphicalMeasure" ; import { VexFlowGraphicalNote } from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalNote" ; import { OpenSheetMusicDisplay } from "../../../../src/OpenSheetMusicDisplay/OpenSheetMusicDisplay" ; import { TestUtils } from "../../../Util/TestUtils" ; describe ( "VexFlow GraphicalNote" , ( ) => { it ( "Can get SVG elements for note, stem and beam" , ( done ) => { const score = TestUtils . getScore ( "test_beam_svg_double.musicxml" ) ; const div = TestUtils . getDivElement ( document ) ; const osmd = TestUtils . createOpenSheetMusicDisplay ( div ) ; osmd . load ( score ) . then ( ( _ ) => { osmd . render ( ) ; const gm = osmd . GraphicSheet . findGraphicalMeasure ( 0 , 0 ) ; const note1 = ( gm . staffEntries [ 0 ] . graphicalVoiceEntries [ 0 ] . notes [ 0 ] as VexFlowGraphicalNote ) ; const noteSVG = note1 . getSVGGElement ( ) ; chai . expect ( noteSVG ) . to . not . be . null ; chai . expect ( noteSVG ) . to . not . be . undefined ; const stemSVG = note1 . getStemSVG ( ) ; chai . expect ( stemSVG ) . to . not . be . null ; chai . expect ( stemSVG ) . to . not . be . undefined ; const beamSVGs = note1 . getBeamSVGs ( ) ; chai . expect ( beamSVGs . length ) . to . equal ( 1 ) ; chai . expect ( beamSVGs [ 0 ] ) . to . not . be . null ; chai . expect ( beamSVGs [ 0 ] ) . to . not . be . undefined ; const note2 = ( gm . staffEntries [ 1 ] . graphicalVoiceEntries [ 0 ] . notes [ 0 ] as VexFlowGraphicalNote ) ; chai . expect ( note2 . getBeamSVGs ( ) . length ) . to . equal ( 1 ) ; const note3 = ( gm . staffEntries [ 2 ] . graphicalVoiceEntries [ 0 ] . notes [ 0 ] as VexFlowGraphicalNote ) ; chai . expect ( note3 . getBeamSVGs ( ) . length ) . to . equal ( 0 ) ; const note4 = ( gm . staffEntries [ 3 ] . graphicalVoiceEntries [ 0 ] . notes [ 0 ] as VexFlowGraphicalNote ) ; chai . expect ( note4 . getBeamSVGs ( ) . length ) . to . equal ( 2 ) ; done ( ) ; } , done ) ; } ) ; } ) ;