jonathantneal / svg4everybody

Use external SVG spritemaps today

Home Page:https://jonneal.dev/svg4everybody/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite loop crashes protractor E2E tests

R4c00n opened this issue · comments

I'm using svg4everybody together with angular. Everything is working like a charm, except for the E2E tests (protractor with chrome).
After digging into the code, it seems like the change introduced with #144 is creating an infinite loop, which causes a timeout on every protractor test.
There are no errors in the browser console.

I'm integrating svg4everybody with webpack.

webpack.js:

...
plugins: [
new webpack.ProvidePlugin({
        svg4everybody: 'svg4everybody'
      })
]
...

app.component.ts:

...
declare var svg4everybody: Function;

@Component({
    selector: 'app',
    templateUrl: './app.component.html',
})
export class AppComponent implements OnInit {
  public ngOnInit() {
    svg4everybody({polyfill: true});
  }
}

A fix that seems to work is to revert the change from #144, but I don't know if this causes another side effect or bug. https://github.com/mediamanDE/svg4everybody/commit/785293ba9519b97de0ff3fc1dc8d67e75e465fe8

Seems like I had to start it outside the Angular zone with NgZone.runOutsideAngular, so I'm closing this issue.