<|start_filename|>src/iframe-resizer.spec.js<|end_filename|>
'use strict';

describe('directive: ng-iframe-resizer', function () {
    var element, scope;

    beforeEach(function () {
        module('ngIframeResizer');

        inject(function($rootScope, $compile) {
            scope = $rootScope.$new();

            element = '<iframe src="about:blank" ng-iframe-resizer></iframe>';

            element = $compile(element)(scope);
            scope.$digest();
        });
    });

    describe('with default settings', function () {
        it ('it should have the id "iFrameResizer0"', function () {
            expect(element.attr('id')).toEqual('iFrameResizer0');
        });
    });
});


<|start_filename|>gulp/conf.js<|end_filename|>
/**
 * This file contains the variables used in other gulp files which define tasks.
 */

var gutil = require('gulp-util');

/**
 * The main paths of the project.
 */
exports.paths = {
    src: 'src',
    dist: 'dist'
};

/**
 * Common implementation of an error handler for a Gulp plugin.
 */
exports.errorHandler = function(title) {
    'use strict';

    return function(err) {
        gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
        this.emit('end');
    };
};


<|start_filename|>karma.conf.js<|end_filename|>
'use strict';

var path = require('path');
var conf = require('./gulp/conf');

var wiredep = require('wiredep');

function listFiles() {
    var wiredepOptions = {
        directory: 'bower_components',
        dependencies: true,
        devDependencies: true
    };

    return wiredep(wiredepOptions).js
        .concat([path.join(conf.paths.src, '/*.js')]);
}

module.exports = function(config) {

    var configuration = {
        files: listFiles(),

        singleRun: true,

        autoWatch: false,

        frameworks: ['jasmine'],

        browsers : ['PhantomJS'],

        plugins : [
            'karma-phantomjs-launcher',
            'karma-jasmine'
        ]
    };

    // This block is needed to execute Chrome on Travis.
    // https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076
    if (configuration.browsers[0] === 'Chrome' && process.env.TRAVIS) {
        configuration.customLaunchers = {
            'chrome-travis-ci': {
                base: 'Chrome',
                flags: ['--no-sandbox']
            }
        };
        configuration.browsers = ['chrome-travis-ci'];
    }

    config.set(configuration);
};


<|start_filename|>gulp/build.js<|end_filename|>
'use strict';

var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');

var $ = require('gulp-load-plugins')({
    pattern: ['gulp-*', 'del']
});

gulp.task('js', function () {
    return gulp.src([
            path.join(conf.paths.src, '/*.js'),
            '!' + path.join(conf.paths.src, '/*.spec.js')
        ])
        .pipe(gulp.dest(path.join(conf.paths.dist, '/')))
        .pipe($.uglify()).on('error', conf.errorHandler('Uglify'))
        .pipe($.rename('iframe-resizer.min.js'))
        .pipe(gulp.dest(path.join(conf.paths.dist, '/')));
});

gulp.task('clean', function (done) {
    $.del([path.join(conf.paths.dist, '/')], done);
});

gulp.task('build', ['js']);


<|start_filename|>src/iframe-resizer.js<|end_filename|>
(function(ngIframeResizer) {
    'use strict';

    angular
        .module(ngIframeResizer, [])
        .directive(ngIframeResizer, function () {
            return {
                restrict: 'A',
                link: function (scope, element) {
                    iFrameResize({}, element[0]);
                }
            };
        });

}('ngIframeResizer'));


<|start_filename|>gulp/watch.js<|end_filename|>
'use strict';

var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');

gulp.task('watch', ['scripts'], function() {

    gulp.watch(path.join(conf.paths.src, '/*.js'), function(event) {
        if (event.type === 'changed') {
            gulp.start('scripts');
        }
    });

});
