it("tracks that the spy was called", function() { foo.getBar(123); expect(foo.getBar).toHaveBeenCalled(); });
it("should not affect other functions", function() { expect(bar).toEqual(123); });
it("when called multiple times returns the requested values in order", function() { expect(foo.getBar()).toEqual("fetched first"); expect(foo.getBar()).toEqual("fetched second"); expect(foo.getBar()).toBeUndefined(); }); });
saveFileWithLink() { var data = { test: 'Hello World', }; var json = JSON.stringify(data); var blob = new Blob([json], { type: 'application/json' }); var url = window.URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = 'test.json'; a.click(); }
通过file-saver包
安装file-saver
1
npm install file-saver --save
1 2 3 4 5 6 7 8 9 10
saveFileWithFileSaver() { var data = { test: 'Hello World', }; var json = JSON.stringify(data); var file = new File([json], 'test.json', { type: 'application/json;charset=utf-8', }); saveAs(file); }
public class Startup { // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
'@知乎 米可爱分享 'https://www.zhihu.com/people/meekou Sub Merge(rng As Range) Dim current As Range Dim result As String result = "" Dim target As Range Application.DisplayAlerts = False For Each current In rng If result = "" Then Set target = current result = result & current.Text Else result = result & Chr(10) & current End If Next rng.Merge target.Value = result Application.DisplayAlerts = True End Sub