# `angular.mock.createMockWindow` (API in module `ng` )

Improve this doc

## Description

This function creates a mock window object useful for controlling access ot setTimeout, but mocking out sufficient window's properties to allow Angular to execute.

## Usage

    angular.mock.createMockWindow();

## Example

    beforeEach(module(function($provide) {
      $provide.value('$window', window = angular.mock.createMockWindow());
    }));

    it('should do something', inject(function($window) {
      var val = null;
      $window.setTimeout(function() { val = 123; }, 10);
      expect(val).toEqual(null);
      window.setTimeout.expect(10).process();
      expect(val).toEqual(123);
    });