bs-autoscale-input
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "bs-autoscale-input", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/Beanstalkhq/bs-autoscale-input", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -6,5 +6,5 @@ /*! | ||
* license: MIT | ||
* version: 1.0.1 | ||
* version: 1.0.2 | ||
*/ | ||
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(){"use strict";/*! | ||
!function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return t[r].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(){"use strict";/*! | ||
* bs-autoscale-input | ||
@@ -16,2 +16,2 @@ * author: Bret Little | ||
*/ | ||
var t=angular.module("bs-autoscale-input",[]);t.directive("bsAutoscaleInput",[function(){var t=function(t,e,n){return"<div style='position: absolute;'><span style='font-family:"+n+";font-size:"+e+" ;'>"+t+"</span></div>"};return{require:"ngModel",restrict:"A",link:function(e,n,r,o){var l=function(e){e=e.length<10?"hello":e;var r=$(t(e,n.css("font-size"),n.css("font-family")));n.after(r),n.width(r.width()||"50px"),r.remove()};n.keyup(function(){var t=n.val();l(t&&t.length?t:n.attr("placeholder")||"hello dawg")}),l(n.val()||n.attr("placeholder")||"hello dawg"),e.$watch(function(){return o.$modelValue},function(){l(n.val()||n.attr("placeholder")||"hello dawg")})}}}])}]); | ||
var t=angular.module("bs-autoscale-input",[]);t.directive("bsAutoscaleInput",[function(){var t=function(t,e,n){return'<div style="position: absolute;"><span style="font-family:'+n+";font-size:"+e+'; font-weight:400;">'+t+"</span></div>"};return{require:"ngModel",restrict:"A",link:function(e,n,r,a){var o=function(e){e=e.length<3?"hello":e,e=e.replace(/\s/g,"_"),r.maxLength&&(e=e.substring(0,r.maxLength));var a=$(t(e,n.css("font-size"),n.css("font-family")));n.after(a),n.width(a.width()||"50px"),a.remove()};n.keyup(function(){var t=n.val();o(t&&t.length?t:n.attr("placeholder")||"hello dawg")}),o(n.val()||n.attr("placeholder")||"hello dawg"),e.$watch(function(){return a.$modelValue},function(){o(n.val()||n.attr("placeholder")||"hello dawg")})}}}])}]); |
{ | ||
"name": "bs-autoscale-input", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "An angular directive time picker.", | ||
@@ -5,0 +5,0 @@ "main": "build/bs-time-pick.js", |
@@ -14,3 +14,3 @@ /*! | ||
var html = function(text, size, family) { | ||
return "<div style='position: absolute;'><span style='font-family:" + family + ";font-size:" + size + " ;'>" + text + "</span></div>"; | ||
return '<div style="position: absolute;"><span style="font-family:' + family + ';font-size:' + size + '; font-weight:400;">' + text + '</span></div>'; | ||
}; | ||
@@ -21,4 +21,7 @@ return { | ||
link: function(scope, el, attr, ngModel) { | ||
function measureAndSize(text) { | ||
text = text.length < 10 ? "hello" : text; | ||
text = text.length < 3 ? "hello" : text; | ||
text = text.replace(/\s/g, "_"); | ||
if(attr.maxLength) text = text.substring(0,attr.maxLength); | ||
var measuredEl = $(html(text, el.css('font-size'), el.css('font-family'))); | ||
@@ -25,0 +28,0 @@ el.after(measuredEl); |
@@ -28,3 +28,3 @@ describe("Beanstalk autoscale input", function() { | ||
it("should scale the input correctly when first rendered", function() { | ||
expect(input.width()).toBe(94); | ||
expect(input.width()).toBe(99); | ||
}); | ||
@@ -34,3 +34,3 @@ | ||
input.val("Hello there!").keyup(); | ||
expect(input.width()).toBe(82); | ||
expect(input.width()).toBe(87); | ||
}); | ||
@@ -45,3 +45,3 @@ | ||
input.val("").keyup(); | ||
expect(input.width()).toBe(169); | ||
expect(input.width()).toBe(189); | ||
}); | ||
@@ -52,4 +52,4 @@ | ||
scope.$digest(); | ||
expect(input.width()).toBe(290); | ||
expect(input.width()).toBe(310); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1286976
33694