title: What are options to unit test requestAnimationFrame in Angular?
body: <p>What are ways to unit test requestAnimationFrame?</p>
  
  <p>requestAnimationFrame has same nature as setTimeout/setInterval have. It is also patched by zone.js like fn's like setTimeout are patched. So options which first came to my mind are</p>
  
  <ol>
  <li>async + whenStable</li>
  <li>fakeAsync + tick(void)</li>
  <li>fakeAsync + flush</li>
  <li>fakeAsync + tick(number)</li>
  <li>setTimeout(1000) + done (jasmine)</li>
  </ol>
  
  <p>The results:</p>
  
  <ol>
  <li>async + whenStable : just don't work</li>
  <li>fakeAsync + tick(void) : don't work</li>
  <li>fakeAsync + flush : don't work</li>
  <li>fakeAsync + tick(number) : works (read below)</li>
  <li>setTimeout(1000) + done (jasmine) : don't work</li>
  </ol>
  
  <p>Here is the method: </p>
  
  <pre><code> reqAnimFrame() {
     requestAnimationFrame(() =&gt; {
       console.log('log stuff');
       this.title = 'req frame title';
     });
   }
  </code></pre>
  
  <p>Here is the unit test (working unit test):</p>
  
  <pre><code>it('fakeAsync', fakeAsync(function () {
    const fixture = TestBed.createComponent(AppComponent);
    const app: AppComponent = fixture.debugElement.componentInstance;
  
    fixture.detectChanges();
  
    app.reqAnimFrame();
  
    tick(16);
  
    expect(app.title).toBe('req frame title');
  }));
  </code></pre>
  
  <p>Magic number. 16 is some magic number like 1000/60. It is the frame size. I just found this magic number by experiments.</p>
  
  <p>Also, idea which came to my mind when I was writing this question: probably, I can somehow mock ng zone and all code which passes through it will be called synchronously (I need that). I haven't tried this yet.</p>
  
  <p>UPD: After some research RAF call just put a task into macrotask zone queue. How to flush this queue from the test? </p>
  
  <p>So what I am missing? How to correctly unit test method with <code>requestAnimationFrame</code> call?</p>