Added test with selection on existing reference. Part of #2362.