Remove use of deprecated APIs

Also add a spec.
Maybe an empty `onDidChangeTitle` function would be better to have here?