test($compile): add test for optional `require` in directives with `^` operator

The directive property `require` allows optional requirement via
the `?` before or after the `^` operator. Add tests to ensure this
functionality is not lost inadvertently.

Closes #9391
Ok, so the actual behavior should be that it passes null if it's not found and optional. So it should say:
"should pass null if required controller can't be found and is optional with the question mark on the right"

I'll try to find time to fix the bug as part of this PR. Thanks!