@financial-times/cp-content-pipeline-ui 6.6.3 → 6.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -763,6 +763,51 @@ describe('Clip', () => {
763
763
  clip.videoEl.addEventListener('playing', listener)
764
764
  clip.videoEl.play()
765
765
  })
766
+
767
+ it('shows loading indicator when waiting event is triggered', (done) => {
768
+ const clip = clips[0]
769
+ const spy = jest.spyOn(clip, 'fadeIn')
770
+
771
+ clip.videoEl.dispatchEvent(new Event('waiting'))
772
+
773
+ setTimeout(() => {
774
+ expect(clip.containerEl.classList.contains('cp-clip--loading')).toBe(
775
+ true
776
+ )
777
+ expect(spy).toHaveBeenCalled()
778
+ done()
779
+ }, 100)
780
+ })
781
+
782
+ it('hides loading indicator when canplay event is triggered', (done) => {
783
+ const clip = clips[0]
784
+ const spy = jest.spyOn(clip, 'fadeOut')
785
+
786
+ clip.videoEl.dispatchEvent(new Event('canplay'))
787
+
788
+ setTimeout(() => {
789
+ expect(clip.containerEl.classList.contains('cp-clip--loading')).toBe(
790
+ false
791
+ )
792
+ expect(spy).toHaveBeenCalledWith(true)
793
+ done()
794
+ }, 100)
795
+ })
796
+
797
+ it('hides loading indicator when canplaythrough event is triggered', (done) => {
798
+ const clip = clips[0]
799
+ const spy = jest.spyOn(clip, 'fadeOut')
800
+
801
+ clip.videoEl.dispatchEvent(new Event('canplaythrough'))
802
+
803
+ setTimeout(() => {
804
+ expect(clip.containerEl.classList.contains('cp-clip--loading')).toBe(
805
+ false
806
+ )
807
+ expect(spy).toHaveBeenCalledWith(true)
808
+ done()
809
+ }, 100)
810
+ })
766
811
  })
767
812
 
768
813
  describe('Captions, credits, and descriptions', () => {