Edit in Plunker
<script>
  function Ctrl($scope, $window) {
    $scope.greeting = 'Hello, World!';
    $scope.doGreeting = function(greeting) {
        $window.alert(greeting);
    };
  }
</script>
<div ng-controller="Ctrl">
  <input type="text" ng-model="greeting" />
  <button ng-click="doGreeting(greeting)">ALERT</button>
</div>
it('should display the greeting in the input box', function() {
 element(by.model('greeting')).sendKeys('Hello, E2E Tests');
 // If we click the button it will block the test runner
 // element(':button').click();
});
'mySceApp', ['ngSanitize']); mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) { var self = this; $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) { self.userComments = userComments; }); self.explicitlyTrustedHtml = $sce.trustAsHtml( '<span onmouseover="this.textContent="Explicitly trusted HTML bypasses ' + 'sanitization."">Hover over this text.</span>'); });
[
{ "name": "Alice",
  "htmlComment":
      "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
},
{ "name": "Bob",
  "htmlComment": "<i>Yes!</i>  Am I the only other one?"
}
]
describe('SCE doc demo', function() {
it('should sanitize untrusted values', function() {
  expect(element(by.css('.htmlComment')).getInnerHtml())
      .toBe('<span>Is <i>anyone</i> reading this?</span>');
});

it('should NOT sanitize explicitly trusted values', function() {
  expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
      '<span onmouseover="this.textContent="Explicitly trusted HTML bypasses ' +
      'sanitization."">Hover over this text.</span>');
});
});
;/div> </div> ext()).toMatch('0'); expect(data.getText()).toMatch('Request failed'); });