<a href="" class="js-func"></a>
$('.js-func').on('click', function(event) {
event.preventDefault();
my_func();
});
<head>
<script>
var metaTag=document.createElement('meta');
metaTag.name = "viewport";
if (screen.width <= 479) {
metaTag.content = "width=480, user-scalable=false"
window.addEventListener("orientationchange", function() {
viewport = document.querySelector("meta[name=viewport]");
if(window.orientation === 90 || window.orientation === -90){
viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=false');
} else{
viewport.setAttribute('content', 'width=480, user-scalable=false');
};
}, false);
} else{
metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=false"
};
document.getElementsByTagName('head')[0].appendChild(metaTag);
</script>
</head>
define([
'angular',
'app/app',
'app/controllers/module',
'angularMocks'
],
function (angular, app, controllers) {
describe('app', function() {
var scope, ctrl, httpBackend;
beforeEach(module('app.controllers'));
beforeEach(inject(function (_$httpBackend_, $rootScope, $controller) {
httpBackend = _$httpBackend_;
httpBackend.when('GET', '../../../DB/options.json').respond(['Hello world!']);
scope = $rootScope.$new();
ctrl = $controller('topMenuCtrl', {
$scope: scope
});
}));
it('list', function() {
expect(scope.list).toEqual([]);
});
});
});
TopMenuCtrl
, a topMenuCtrl
. Во вторых надо передать кроме модуля app ещё и модуль controllers. После чего обращаемся к нему такbeforeEach(module('app.controllers'));
$('input').attr('type');
$('input[type="range"]').attr('value');
$('input[type="range"]').val();
var value = $('input[type="range"]').val();
console.log(value);
$('input[type="range"]').on('change mousemove', function() {
var value = $( this ).val();
});