Break line tooltip angular material

Here's an example using your markup/code (which works fine) - stackblitz

To get the CSS to work I had to put the class in the file styles.css rather than the component stylesheet. This was taken from willshowell's comment to this issue - https://github.com/angular/material2/issues/8316

Edit: The following works in the component stylesheet

::ng-deep .test {
  white-space: pre-line;
}

The documentation suggests ::ng-deep is deprecated but it still works with the latest version.